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

    Can I insert JavaScript code in the Submit button

    Asked by micici on April 04, 2016 at 08:58 AM

    Hello,

     

    I would like to know if it's possible, and if yes, how, to add code to my "Submit" button in my form.

    The point is to add action, on top of sending the form.

    Ideally, I would like to do that on my page and not on the form self to avoid making a lot of different form for each different actions I would llike to add to the button.

     

    I hope I was clear enough with my question..

     

    Best Regards,

    insert code javascript code
  • Profile Image
    JotForm Support

    Answered by Welvin on April 04, 2016 at 11:09 AM

    For security reasons, we restrict adding scripts in the form so what you can do would be to get the form source codes and modify the source codes before embedding it to your website.

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

    You can save the source as an HTML and then you can embed the HTML file as an iframe to your page. Of course, you have to upload the HTML first to your own server.

  • Profile Image

    Answered by micici on April 05, 2016 at 09:45 AM
    Hello,
    Thank you for your answer.I found a way to simulate the click on the "Sending" button on my page, so my problem is partially solved.
    Now I need to hide the button from my page, without deleting it or else I can't simulate its click.
    I tried to put its display to none but oddly it doesn't work..document.getElementById('60892377133359').contentWindow.document.getElementById("input_2").style.display = "none";
    Do you have a solution to hide the button?
    Thanks.
    Cordialement,
    Cindy, MiCICI
    www.micici.fr

    ...
  • Profile Image
    JotForm Support

    Answered by Welvin on April 05, 2016 at 10:51 AM

    That's great to know. As for hiding the submit button, I needed to move it to a new thread. Please find my answer to that question in this thread: https://www.jotform.com/answers/810837