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 to know when user has pressed the submit button using an embedded iFrame form?

    Asked by jpaprocki on May 18, 2016 at 03:04 PM

    I am embedding this into my website (using iframe currently). How can I tell when the user has pressed the submit button to capture that event?


    Page URL:

  • Profile Image
    JotForm Support

    Answered by Kevin_G on May 18, 2016 at 04:51 PM

    If I can understand you correctly, you're trying to capture the even when the submit button is clicked, this seems to be possible as per this link: https://forum.jquery.com/topic/changing-elements-in-an-iframe

    I have tried to capture the click event of the submit button, but this does not seem to be possible when the page where the iFrame is loaded is not the same origin as the link in the iFrame, here is the error message I'm currently getting: 

    This seems to be a normal error, since it is a must that the all where the iFrame is being embedded needs to be the same as the link that loads in the iFrame, and this is due to security reasons, I found a link where this is explained as well, take a look here: http://stackoverflow.com/questions/26329519/uncaught-securityerror-failed-to-read-the-contentdocument-property-from-html 

    If you want to get the event when the submit button is clicked and trigger an action I would suggest you to use the source code instead, you will be able to handle elements in the form using your custom Javascript/jQuery code, here is a guide that will help you to get the source code: