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

    Form bypasses my JS validation and submits even on validation failure

    Asked by ronaldlthomas on April 04, 2014 at 02:46 PM

    I've tried several different methods to validate my form using javascript but regardless of what I try the form submits anyway, even after the alert pops up telling me that the form submission is invalid.

    I've used a method inside the form tag

    <form ... onsubmit="return isNumeric()">

    with this function

    function isNumeric() { var numericExpression = /^[0-9]+$/; var area = document.getElementById('input_18_area').value; if(area.match(numericExpression)){ return true; } else { alert(numbers only please); return false; }}
    I've also tried adding <button ... onclick="isNumeric(document.getElementById('numbers'), 'not submitted')"></button> input_8.onclick=function() { var vemail = document.getElementById('input_4').value; if (vemail === "" || vemail === " ") { alert('Please correct the errors'); return false; } else { return true; } }; Any thoughts on what I might be doing wrong?
    Page URL:

  • Profile Image

    Answered by KadeJM on April 04, 2014 at 04:34 PM

    Looking at your form I think what's going wrong as that the custom js you are using is probably conflicting with the form's own js libarary so it is causing it to break and not work.

    I see the code you are using but what you are trying to do and validate with it is a bit sketchy. However, It could probably work so long as you are using the form's source code on your website which it I believe you are doing already it seems. So I think it will just require some further tweaking.

    Can you please provide us with further details about what you are doing and we'll do what we can on our end to help aid you with fixing this.