PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Execute JS on AJAX submit

  1. Mastal
    Member

    When a form is submitted via AJAX and it have validation errors (for example a required field is empty), I need to execute a JS file over the returned form, but I havent find a way to do it. Is there a solution to this problem?

    Thanks

    Posted 12 years ago on Sunday May 6, 2012 | Permalink
  2. David Peralty

    Can you give me more information on what you are trying to do as well as a link to your form?

    Posted 12 years ago on Monday May 7, 2012 | Permalink
  3. Mastal
    Member

    Hi David,

    I have a script wich do some modifications over the inputs (adds placeholders and things like that). When I load the form that script is executed normally but if I send the form via AJAX and it have errors, the form returned with errors isnt affected by my script:

    http://pastebin.com/SHX6qUVz

    I need to execute again that script when the form has errors. I guess that the problem may be solved easily if i send the form via POST, but i need to send the form via AJAX request.

    I cant show you the form cause it is in my local server :(

    Thanks

    Posted 12 years ago on Friday May 11, 2012 | Permalink
  4. Mastal
    Member

    Help please :(

    Posted 12 years ago on Wednesday May 16, 2012 | Permalink
  5. David Peralty

    So you need to hook into the AJAX form submit and then run your JavaScript again?

    Posted 12 years ago on Wednesday May 16, 2012 | Permalink
  6. Mastal
    Member

    Yes, I need to execute js code over the gravity form after submit the form if it have validation errors

    Posted 12 years ago on Monday May 21, 2012 | Permalink
  7. Mastal
    Member

    Is possible to do this with gravity forms?

    Posted 12 years ago on Wednesday May 23, 2012 | Permalink
  8. Sounds like this is what you are looking for:
    http://www.gravityhelp.com/documentation/page/Gform_post_render

    Posted 12 years ago on Wednesday May 23, 2012 | Permalink