We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 32025
    • 305 Posts
    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:
    Region: 1

    Is it possible to show the drop down in the e-mail? What am I doing wrong here?
      Making the web a better place on site at a time! Dayton Web Design: http://www.dayton-web-design.com/
      • 32025
      • 305 Posts
      Can anyone please help me with this? wink
        Making the web a better place on site at a time! Dayton Web Design: http://www.dayton-web-design.com/
        • 28042 ☆ 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.
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
          • 32025
          • 305 Posts
          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.
            Making the web a better place on site at a time! Dayton Web Design: http://www.dayton-web-design.com/
            • 28042 ☆ 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.
              Studying MODX in the desert - http://sottwell.com
              Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
              Join the Slack Community - http://modx.org
              • 4310
              • 2,310 Posts
              <option value="" selected="selected">Please Select...</option>

              Should show as selected but fail eForm validation so forcing the user to select another option
                • 32025
                • 305 Posts
                Susan and David. The solution you provided works like a charm. Thank you both your awesome! wink

                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.
                  Making the web a better place on site at a time! Dayton Web Design: http://www.dayton-web-design.com/