I would like to have a drop-down list set its default value based on the logged-in user’s email address.
We have multiple domains so for example
if anyuser@domain1.com DropDown list default = A,
if anuser@domain2.com DropDown list default = B
Does anyone know if this is possible? If it is and code is needed what file do I add it to?
uamv
(Joshua Vandercar (Gravity Forms))
2
You can take the approach of dynamically populating the field via hook. The filter you will use for this is gform_field_value_$parameter_name. Those documents should outline pretty well how to use this hook. In short, what you need to do…
-
Allow field to be populated dynamically on the Advanced tab of the hidden field.
- Define a custom Parameter Name which can be used to the populate that field. (eg. domain_identification )
- Set the filter to target that specific parameter. (eg. gform_field_value_domain_identification )
- From the function hooked to that filter, you’d check the user’s email address and return the value to populate the field.
Reference: Where Do I Put This Code? for various ways to include the code in your site.
2 Likes
system
(system)
Closed
3
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.