I added a drop down field to my form. What I would like to do is show this field selection in the e-mail that is sent to me. Here is the code I added to the eFeedbackForm Chunk:
<p><label for="region">Region:</label>
<select name="region">
<option value="1">Please Select...</option>
<option value="2">Dayton</option>
<option value="3">Columbus</option>
<option value="4">Cincinnati</option>
</select></p>
Then I added this to the eFeedbackReport Chunk:
<tr valign="top"><td>Region:</td><td>[+region+]</td></tr>
My e-mails only say this:
Is it possible to show the drop down in the e-mail? What am I doing wrong here?
Can anyone please help me with this?
-
☆ A M B ☆
- 24,524 Posts
What gets displayed in the result is the value attribute of the selected option. Put whatever you want to see in your report as the value="..." attribute of the options.
<option value="Dayton">Dayton</option>
If there is some reason why you must have the value attributes as you’ve posted, you can create a custom snippet with a function to process the $fields array and change the values as appropriate before the mail is sent.
if($fields['region'] == 2) $fields['region'] = 'Dayton';
Then when the report tpl is processed, your new values will be used.
Sottwell, that solution worked great. I appreciate your help. Now I have this:
<p><label for="region">Region:</label>
<select name="region">
<option value="Please Select">Please Select...</option>
<option value="Dayton">Dayton</option>
<option value="Columbus">Columbus</option>
<option value="Cincinnati">Cincinnati</option>
<option value="Other City">Other City</option>
</select></p>
My only problem now is that the user is
not forced to select from this drop-down. Is there an easy solution that would force the user to select any other item other than: "Please Select..."? Bascially, I want to force them to select a city.
-
☆ A M B ☆
- 24,524 Posts
<select name="region" eform="Select Region::1">
That will make a selection mandatory, but I’m not sure how to make sure something other the first default is selected.
Susan and David. The solution you provided works like a charm. Thank you both your awesome!
For those of you who are following this and want to know how to add a forced drop down, here is the completed code:
<p><label for="region">Region:</label>
<select name="region" eform="Select Region::1">
<option value="" selected="selected">Please Select...</option>
<option value="Dayton">Dayton</option>
<option value="Columbus">Columbus</option>
<option value="Cincinnati">Cincinnati</option>
<option value="Other City">Other City</option>
</select></p>
This forces the user to select another option from the drop-down. You can of course change the label from "region" to what you need it for, and each value name (that I have populated with a City). This would be nice to have added to the eForm instructions.