admin管理员组

文章数量:1291045

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?

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?

Share Improve this question edited Mar 30, 2019 at 15:17 Rowbee asked Mar 29, 2019 at 20:17 RowbeeRowbee 132 bronze badges 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. – norman.lol Commented 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 Commented Mar 30, 2019 at 15:15
Add a comment  | 

2 Answers 2

Reset to default 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/gform_pre_render/#3-populate-field-with-values-from-earlier-page

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 );

本文标签: pluginsMerge tags in multistep Gravity Form