I am running the most curent version of WP and Gravity forms. I’m trying to call the form through a template file and pass through a few things like so:
gravity_form(2, $display_title=false, $display_description=true,
$field_values, $ajax=true);
I’m calling the $field_values
like so:
$field_values = array("my" => "FOO", "your" => "BAR",);
They are simple not populating into gravity forms. Any ideas?
Make sure to click on the field and then click on the advanced tab and check mark the prepopulate field checkbox. This will drop down a text box in which you can specify a parameter name.
Ok, lets say that your form ID is 7, let me give you a step-by-step answer:
my_name
gravity_form(7, false, false, false, array('my_name'=>'whatever you want to autofill'), false);
Now if you go to that form you will see that the field which had the name
my_name
has the valuewhatever you want to autofill
.Hope this helped, bye bye.
This documentation gives some helpful advice on populating fields:
gravityhelp.com/documentation/page/Allow_field_to_be_populated_dynamically
and here is an example of how I populate fields using a hook:
In order for this to work, you must check the box in the advanced tab of the form item in your Gravity Form that allows the field to be populated dynamically. Then you need to fill in the input below with ‘youparametername’.