Do we have a JavaScript callback function when we submit a form?

  • saishneogi
    Asked on May 10, 2019 at 8:25 AM

    Hi, Do we have a JavaScript callback function when we submit a form? I have downloaded the source code and embedded it as an HTML in my web-page. How to check for form submissions?

  • Ashwin JotForm Support
    Replied on May 10, 2019 at 10:50 AM

    Unfortunately for security reasons, it is not possible to add any script code in form. Since you have already downloaded the form's full source code, you can add the desired script code in source code of form. 

    How to check for form submissions?

    Even if you have downloaded form's full source code, the action URL of form does not change. When the form is submitted, the data is captured in JotForm. You can go to your form's submission page to view all the submissions you have received. The following guide should help you: https://www.jotform.com/help/269-How-to-View-Form-Submissions

    Hope this helps. 

    Do get back to us if you have any questions.

  • saishneogi
    Replied on May 10, 2019 at 11:43 AM
    Hi,
    Thanks for the response. I read the custom widget api doc that you have. In that I found some JS events which the form has. Can we use that to perform some action when a form is submitted.
    Get Outlook for Android
    ________________________________
    ...
  • Ashwin JotForm Support
    Replied on May 10, 2019 at 1:51 PM

    What action exactly you want to perform when form is submitted? 

    Please explain your complete requirement a bit more in detail and we will try to help you. 

    We will wait for your response.

  • saishneogi
    Replied on May 10, 2019 at 3:43 PM
    Hi,
    I want to store a cookie when the user submits a form and based on that cookie I want to show/hide the form on the website
    Get Outlook for Android
    ________________________________
    ...
  • stevenmarshall
    Replied on May 10, 2019 at 6:15 PM

    Hi @saishneogi,

    Regarding your question, I want to store a cookie when the user submits a form and based on that cookie I want to show/hide the form on the website.

    This option might meet the requirements that you are looking for.

    Guide: Auto-Popup-Lightbox-Embed-Form-With-Cookie-Using-Javascript

  • saishneogi
    Replied on May 13, 2019 at 1:43 AM
    HI,
    This is different from what I am trying to achieve. The first thing is I don't want a lightbox. That form will be like an entry point. So once that form is filled I would display certain parts of the pages.
    Second thing is, Unlike the example which shows the form only first time and once you refresh it doesn't show the form. I need to show the form untill the user fills it and store a cookie once he fills the form. That cookie will remain in the user's browser for a long time.
    SAISH NEOGI
    CREATIVE CAPSULE
    M (INDIA): +91 992-366-7564
    O (INDIA): +91 902-800-5611 | WWW.CREATIVECAPSULE.COM
    ________________________________
    ...
  • Ashwin JotForm Support
    Replied on May 13, 2019 at 4:01 AM

    Why do you need a widget to achieve this? You can download your form's full source code and embed it in your webpage. After few forms fields are fill in, you can set a cookie or session value and then based on that you can show / hide the part of your webpage. You can also use the cookie value to show/hide the form if user refresh the page after filling up form. 

    This does not require you to use a custom widget and more over the widgets are always loaded inside an iFrame and you will not be able to change any code of the widget even if you download your form's full source code. 

  • CelularityWebsites
    Replied on May 13, 2019 at 4:10 AM

    So we don't have any callback function to make sure the form is successfully submitted?


  • Ashwin JotForm Support
    Replied on May 13, 2019 at 5:39 AM

    The easiest way to know if the form was submitted successfully is by taking advantage of our thank you message feature.

    You can create your own page in your server where you can add some script code to track submission based on your requirement. You can post your form's data, read it in your custom page and you can also trigger your own code as well. Won't this work for your requirement?

    The following  guide should help you how to redirect users to your own page after form is submitted: https://www.jotform.com/help/38-Redirecting-Users-to-a-Different-Page