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

    javascript field validation

    Asked by martincrumpton on November 09, 2016 at 04:03 PM

    I have a javascript function that returns true or false based on a calculation done on the value passed to it. I would like to use this function to validate the contents of a text box on my jotform. I understand that I need to add the function to the source code but I am not sure how to integrate it into the form.

  • Profile Image
    JotForm Support

    Answered by Jim_R on November 09, 2016 at 08:26 PM

    Hello, you will not integrate it with the form itself (within JotForm) because we do not allow insertion of any sort of script on any part/section of your form.

    Your understanding is correct that you need to use the Full Source code of your form, but integrating your JS function would mean you would do it from your end. The general workflow would be as follows:

    1. You grab your form's Full Source code.

    2. You embed it anywhere you like.

    3. On that same page where you embedded the full source code, that's where you need to point your JS function to validate the contents of a textbox on your form.

    If I were in your shoes, I would approach this by hooking up your function to the element ID of the textbox.