Search code examples
javascriptwordpressgravityforms

Programmatically submitting a Gravity Form


I have created a gravity form and would like to programmatically submit it. I want to create a template in WordPress that is a custom HTML form, all the data then get's submitted to the actual form for the Gravity Forms logic to occur.


Solution

  • Check out the GFAPI::submit_form() method:

    https://docs.gravityforms.com/api-functions/#submit-form

    You can take the data submitted in the HTML form, format the data into a structure that Gravity Forms expects and then pass it to this function to trigger an artificial submission.