limit only numbers for text area

  • Profile Image
    Asked 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
    Answered 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

    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;


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