What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.

At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.

We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.


  • Profile Image

    limit only numbers for text area

    Asked by wuichy on November 20, 2013 at 01:25 PM

    If there any way that i can limit a text area so users can only text numbers?

  • Profile Image
    JotForm Support

    Answered by ardy0689 on November 20, 2013 at 04:17 PM

    Hello, thanks for posting your inquiry here on the forum

    Unfortunately, we do not have a validation function yet for text area boxes. We do have numeric validation for text boxes but not text area.

    However, there is a workaround for this but you are going to need to use the form source code of the form and host it on your webserver.

    Assuming that this is the HTML code for JotForm Text area:

    <textarea id="input_3" class="form-textarea" rows="6" cols="40" name="q3_clickTo"></textarea>

    You have to change it to this:

    <textarea id="input_3" class="form-textarea" rows="6" cols="40" name="q3_clickTo" onkeypress="return isNumber(event)"></textarea>

    Technically, I just added the onkeypress="return isNumber(event)".

    After that, add this Javascript just below the text area HTML

    <script>
    function isNumber(evt) {
        evt = (evt) ? evt : window.event;
        var charCode = (evt.which) ? evt.which : evt.keyCode;
        if (charCode > 31 && (charCode < 48 || charCode > 57)) {
            return false;
        }
        return true;
    }
    </script>

     

    Please let us know if this does not work for you. Thank you