0

I want to use a multi-step form where the user enters their name in step one, then on step two the form will say "Hello, [name]" with the rest of the content and steps to follow.

Any ideas?

EDIT: I want to use data entered in step one on step 2. Reading GF documentation I think something like {[Field Name]:[field_id]} should work, but it does not. Digging further I found that this would only work once a form has been submitted already. So my question is, is there a way that will enable me to use the merge tags within the current form from data being submitted in a previous step?

2
  • Welcome to WordPress development! Unfortunately it's unclear what you are asking as you didn't tell us what exactly you've tried so far and where you are stuck right now. Please update your question accordingly as otherwise it's just too broad.
    – leymannx
    Mar 30, 2019 at 8:59
  • That is fair. I am trying to use merge tags in a multi-step form. I want to use data entered in step one on step 2. Reading GF documentation I think something like {[Field Name]:[field_id]} should work, but it does not. Digging further I found that this would only work once a form has been submitted already. So my question is, is there a way that will enable me to use the merge tags within the current form from data being submitted in a previous step?
    – Rowbee
    Mar 30, 2019 at 15:15

2 Answers 2

1

This is possible with Live Merge Tags, a feature of Gravity Forms Populate Anything.

If you're looking to get your hands dirty with some code, Gravity Forms has an example of how this might work with a snippet on their docs for the gform_pre_render filter:

https://docs.gravityforms.com/gform_pre_render/#3-populate-field-with-values-from-earlier-page

1
  • This is the ticket, thank you.
    – Rowbee
    Mar 31, 2019 at 22:04
0

It's pretty easy to extend the GF_Field_HTML class to do this then register it at the gform_loaded action. You'll want to override the get_field_input method and where the original has this:

$content = GFCommon::replace_variables_prepopulate( $content );

your replacement should have this:

$lead = GFFormsModel::get_current_lead();
$content = GFCommon::replace_variables( $this->content, $form, $lead );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.