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.

Using Field Values after form submission

  1. dtgreen
    Member

    Hello!

    I'm looking to calculate a price for the user after the form has been submitted, taking several of the field values to do some math before a price is show on screen.

    What's the best way to achieve this?

    To clarify, I want to re-direct the user to a script after the form has been successfully submitted, but the script will need to access all the field data from the submission itself.

    Will the Entry Object data still be available post-submission? If so, I guess it is just a case of accessing the array and assigning the required fields to my own variables, no?

    Thanks,
    Dave

    Posted 12 years ago on Monday July 9, 2012 | Permalink
  2. David Peralty

    The entry object isn't available once you leave Gravity Forms. You could do one of the following:

    Pull the latest submission from the database after the form is submitted. So you would use Gravity Forms to redirect to your script page. Your script would grab the latest lead in the database and use that information to determine what it needs to do.

    You could send all the data via query string by doing redirect, checking the query string check box, and adding the variables you would want to access.

    You could use our post_submission hook and send data to your script and set it up to send back a response. The data would be sent and returned in the background.

    You could find a way to create a session on the form, and using one of many hooks, set data into the session variable and be able to pull it back out in your script if you keep the session alive in PHP.

    Have a look at our hooks here:
    http://www.gravityhelp.com/documentation/page/Developer_Docs

    Again, specifically the pre_submission post_submission hooks.

    Posted 12 years ago on Monday July 9, 2012 | Permalink
  3. dtgreen
    Member

    Thanks for that David.

    I suppose sending the variables I need across in the query string would be be most straight forward way of doing things!

    Regarding the use of the hook, lets say I have one final variable (the price of the quote, for example) that I want my script to pass back, how can I achieve that and how would I then use that on the thank you/confirmation page?

    Thanks
    Dave

    Posted 12 years ago on Wednesday July 11, 2012 | Permalink
  4. David Peralty

    If you leave Gravity Forms to go somewhere else, you can't pass things back to the form like that. Can you give me more information on what exactly you are trying to do so I can give you the best possible response?

    Posted 12 years ago on Wednesday July 11, 2012 | Permalink