How to know when user has pressed the submit button using an embedded iFrame form?

  • jpaprocki
    Asked on May 18, 2016 at 3: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?

     

  • Kevin Support Team Lead
    Replied on May 18, 2016 at 4: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: 

    How to know when user has pressed the submit button using an embedded iFrame form?  Image 1 Screenshot 20

    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: 

    How-to-get-the-Full-Source-Code-of-your-Form