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.

Prevent form saving & programatically submit form

  1. fredsfriend

    I have two questions regarding functionality that are interrelated:

    1. Is there a way to prevent the saving of a form?
      I have a requirement to optionally not save a form dependent on the value of one of its fields. I know that i can use gform_pre_submission_N to get access to the form data after submission and before it is saved. Is there a way to use this hook to tell Gravity forms not to save the current form? The Hook documentation isn't very detailed, returning false doesn't seem to work.
    2. Is there a way to programatically submit a form with arbitrary data?
      If i have captured the data from the previously cancelled form submission in a $_SESSION variable and then dependent on further actions on the site fill out a new form instance and submit it. A PHP solution would be preferable, however a having to use an embedded form with hidden fields and javascript to fill the values would be acceptable.

    Thanks for any help, let me know if i am being too obscure in my description.


    Posted 13 years ago on Wednesday March 2, 2011 | Permalink
  2. Currently there is no way to automatically prevent the entry data from saving. It's automatic. It is possible to implement a customization to automatically delete the entry immediately after it is created. But the Notifications themselves use the Entry data (not the form post) to send the email notifications. So you'd want to do this after the Notifications are sent, otherwise you'd get nothing from a form submit. Here is information on how to implement this:

    I'm sure you could probably programatically submit a form, but you would have to write custom code to do so. You would have to know exactly what needs to be posted and then write custom code to do it using code.

    Posted 13 years ago on Wednesday March 2, 2011 | Permalink