You can't use a short code within a short code or a function call within a short code.
What you will have to do is use PHP and an available hook to pre-populate the fields via your session data. This will be accomplished by placing a snippet of code in your themes function.php file that pre-populates the field.
- edit the field you want to pre-populate in the Form editor
- select the advanced tab
- check the "Allow field to be populated dynamically" checkbox
- give the dynamic field a Parameter Name (ex. city). This parameter name is what will be used in the querystring to pass the value.
- save your form
- edit your themes function.php file
- place this code snippet into your function.php file
add_filter("gform_field_value_city", "populate_city");
function populate_city(){
$city_value = "Test";
return $city_value;
}
Now the example above is based on populating a field with the parameter name "city" with the value of "Seattle". Notice everywhere "city" appears. This would be replaced with the parameter name for your field (ex. firstname, etc.). You can then set the value to whatever you want (session, etc.).
In your situation you would give each of the fields you want to populate a parameter name (ex. firstname, lastname, etc.) and then add the above filter for each of these fields to your themes function.php file... changing it each time to target the appropriate parameter name.
Posted 14 years ago on Monday February 8, 2010 |
Permalink