Not automatically. You would have to use available API hooks to pre-populate fields using PHP.
To populate a field dynamically you first need to set permissions on that field so that it can be populated dynamically.
- Edit your form
- Edit the field you want to populate dynamically
- Select the Advanced tab
- Click the "Allow field to be populated dynamically" checkbox
- Enter a parameter name (this parameter name is what you then use to populate the field. An example would be use a parameter name of email for an Email field, etc.).
- Repeat for each field you want to populate dynamically
Once you have set your fields up to be populated dynamically you can now either populate those fields either by passing the value via the querystring, or by adding some custom PHP code to your theme.
To populate a field using the querystring you would simply pass a value to that page via the querystring using the parameter name for the field you want to populate. For example, if you gave an Email field the parameter name email you could populate it like so:
mydomain.com/myform?email=john@doe.com
To populate a field using PHP you would add a code snippet to your themes functions.php file and use the gform_field_value_$parameter hook. It looks like this (using a parameter name of email as an example):
<?php
add_filter("gform_field_value_email", "populate_email");
function populate_email($value){
return "john@doe.com";
}
?>
You would do the above for each field you want to populate dynamically, making sure you change the code so it uses the appropriate parameter name you setup when setting fields to be populated dynamically.
The code you would need to use would be slightly different because you wouldn't be returning a hardcoded value, you would have to change it to return the value you want to return... in your case the users email or name. You'd have to get this data from WordPress.
If you need help implementing this I can refer you to WordPress developers that have Gravity Forms customization experience.
Posted 13 years ago on Tuesday November 30, 2010 |
Permalink