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

    How can I add my own validation to the form

    Asked by sudipsaha on January 22, 2016 at 12:42 PM

    Hi,

     

    I created several forms with Jotform. I am trying to write validation function in javascript by adding the attribute onsubmit. The functions get fired when I submit the form, but the form still get submitted. I tried to work with the similar form which doesn't have any jotscript function and that works perfectly. Can you please advise how can I add validation function of my own in jotform.


    Thanks

    Sudip Saha

    does not work on submit work JotForm thanks and functions
  • Profile Image
    JotForm Support

    Answered by david on January 22, 2016 at 01:44 PM

    Hi,

    It is not possible to add javascript directly in the form.  You can, however, get the full source code of your form and insert your validation in that code:

    http://www.jotform.com/help/104-How-to-get-the-Full-Source-Code-of-your-Form

     

     

  • Profile Image

    Answered by sudipsaha on January 22, 2016 at 02:45 PM
    Hi
    Thank you for your response. I am adding the validation function. But for
    some reason, the form get still submitted when onsubmit returns false.
    Thanks
    Sudip Saha
    ...
  • Profile Image
    JotForm Support

    Answered by david on January 22, 2016 at 03:46 PM

    I believe the form will still submit as long as it passes the JotForm validation.  Your validation requirements would not need to be met in order to complete the form.

  • Profile Image

    Answered by sudipsaha on January 22, 2016 at 04:45 PM
    Hi David,
    Thank you for your response. How can I add my validation requirement with
    the JotForm requirement. Is this possible?
    Thanks
    Sudip Saha
    ...
  • Profile Image
    JotForm Support

    Answered by Kevin_G on January 22, 2016 at 06:08 PM

    Hi,

    You will find the default validations on the top toolbar :

    You may also add a mask to your field : 

    However, the mask does not avoid to submit the form, and as explained by my colleague, it's not possible to add your custom validation, since it's not possible to add custom Javascript codes.