Validate the text length

  • Profile Image
    Jerome_ua
    Asked on January 21, 2013 at 08:30 AM

    Hi there

    Jotform has several validations (*required, numeric etc.).

    But I need to validate the length of text in Text Box. Is it possible to to set range 200...1000 characters?

    Text Box already has upper limit (Entry Limit). But in my case I also need lower limit.

    Thanks!

  • Profile Image
    Deygus
    Answered on January 21, 2013 at 12:13 PM

    Unfortunatley our form's do not fully support this type of feature yet. We only currently offer a maximum that can be set. Something like this would require using your form's source code with a little bit of programming knowledge if you have any and you can also refer to one of my colleagues (Abajan's) workaround solutions in this thread here http://www.jotform.com/answers/54587-How-do-I-ensure-that-users-enter-no-less-than-a-certain-number-of-characters-into-a-text-box where you could apply a similar effect to create the limitation.

  • Profile Image
    Jerome_ua
    Answered on January 21, 2013 at 02:21 PM

    Thanks for your reply. Will try it.

    And what about Text Areas? Is there are any similar solutions for them?

    I guess it is possible to edit javascript. But unfortunately my knowledges are poor.

  • Profile Image
    jeanettebmz
    Answered on January 21, 2013 at 04:45 PM

    The javascript function should also work to validate text

    You just need to change the number of characters defined by  the function -lets say  mustBe200() function- and get the correct id field for the Text Area  field .

    Of course, you can also customize the message alert . So  field_X should be replaced by the correct id field

    <script type="text/javascript"> function mustBe200()
    if (document.getElementById("field_x").value.lenght !=200)
    alert ("Limit of characters must be less than 200")
     } </script>


  • Profile Image
    Jerome_ua
    Answered on January 21, 2013 at 05:08 PM

    Yes, it works.

    It is not so beautiful as Jotform's red hints below fields but still suitable.

    Thank you for quick answer. I like Jotform's support team very much! :)

  • Profile Image
    jonathan
    Answered on January 21, 2013 at 05:48 PM

    Hi,

    We're glad to know it works now. Contact us again anytime should you have other inquiry.

    Thanks.