Dynamically populate a Contact Form 7 dropdown list
-
Hi
I used the code below to load dynamic content on dropdown field.
Credit: https://bdwm.be/<label>
Your name
[text your-name]
</label>
<label>
Choose your gig
[select upcoming-gigs data:gigs]
</label>
[submit]add_filter(‘wpcf7_form_tag_data_option’, function($n, $options, $args) {
if (in_array(‘gigs’, $options)){
$gigs = array(
“MAY 07 – NEW ORLEANS, LA”,
“MAY 09 – AUSTIN, TX”,
“MAY 12 – HOUSTON, TX”
);
return $gigs;
}
return $n;
}, 10, 3);`I want to add drop down options as below: so user Selects Agency A, the email sends to corresponding email id. But the end user will be able to view only text before the pipe symbol. ie. Agency A, B, C etc
“Agency A | [email protected]”
“Agency B | [email protected]”
“Agency C | [email protected]”However using the code, the whole text is visible from the front drop down options. Is there any way to dynamically add content with Pipe to achieve the above requirement?
- The topic ‘Dynamically populate a Contact Form 7 dropdown list’ is closed to new replies.