You would do this using custom PHP and the gform_field_value filter hook. Documentation for this hook is below:
http://www.gravityhelp.com/documentation/page/Gform_field_value_$parameter_name
In order to use this hook you must do the following:
- Edit your Form
- Add a hidden field you want to populate and give it a name
- Edit the hidden field
- Select the Advanced tab
- Select the "Allow field to be populated dynamically" checkbox
- Give the field a parameter name, this parameter name is used to target the field so name it something simple like "email" or something similar.
- Save your form
Then you would use the gform_field_value hook by adding custom code in your themes functions.php file to dynamically populate that field. For example, if you set the parameter to "email" your code would look like this:
<?php
add_filter("gform_field_value_email", "populate_email");
function populate_email($value){
return "email@value.com";
}
?>
Posted 13 years ago on Wednesday March 30, 2011 |
Permalink