javascript field validation

  • martincrumpton
    Asked on November 9, 2016 at 4: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.

  • Support_Management Jotform Support
    Replied on November 9, 2016 at 8: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.