We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28099
    • 39 Posts
    For some reason, my forms are going to all addresses rather than the one that mailSelector specifies.

    My call:
    [!eForm? &formid=`contactForm` &subject=`Contact Form`  &to=`[email protected],[email protected]` &mailSelector=`recipient` &tpl=`contactForm` &report=`contactFormReport` &gotoid=`31`  !]
    


    My form:
    <p>All fields with an (<span class="required">*</span>) are required</p>
    
    <form method="post" action="[~[*id*]~]" enctype="multipart/form-data">
        <div><input type="hidden" name="formid" value="contactForm" /></div>
    
        <dl>
            <dt><label for="recipient">Department <span class="required">*</span></label></dt>
            <dd><select name="recipient" id="recipient">
            <option value="0">Choose Recipient</option>
            <option value="1">Geophysics</option>
            <option value="2">Business Development</option>
            <option value="3">Field Operations</option>
            </select></dt>
    
            <dt><label for="job">Job <span class="required">*</span></label></dt>
            <dd><input type="text" id="job" name="job" size="61" eform="Job:html:1" /></dd>
    
            <dt><label for="name">Name <span class="required">*</span></label></dt>
            <dd><input type="text" id="name" name="name" size="61" eform="Name:html:1" /></dd>
    
            <dt><label for="email">Email Address <span class="required">*</span></label></dt>
            <dd><input type="text" id="email" name="email" size="61" eform="Email Address:email:1" /></dd>
    
            <dt><label for="phone">Phone</label></dt>
            <dd><input type="text" id="phone" name="phone" size="61" /></dd>
    
            <dt><label for="comments">Comments <span class="required">*</span></label></dt>
            <dd><textarea id="comments" name="comments" rows="8" cols="59" eform="Comments:html:1" ></textarea></dd>
    
            <dt><label for="attachment">Resume</label></dt>
            <dd><input class="field" type="file" name="attachment" id="attachment" eform="Attachment:file:0:Only upload of text documents are supported:#LIST pdf,txt,doc,docx " /></dd>
    
        </dl>
        <p class="submit"><input type="submit" name="submit" value="Submit!"></p>
    </form>
    
    <p class="required">[+validationmessage+]</p>
    


    The only thing I am doing that would be different than normal, is that I am passing two variables from the job application page to the form. I am carrying over the job title as well as ’recipient’ value. The variables make it to the form so I assume it does not interfere with eForm since the script has already done its job.

    Here is that JS code for passing variables, just in case...
    <script type="text/javascript">
    //<![CDATA[
    var windowOnloads = window.onload ;
    window.onload = function () {
       if (typeof windowOnloads == 'function') {
           windowOnloads();
       }
       populateFields();
    }
    function populateFields() {
      var query = location.href.split('?');
      var values = query[1].split('&');
      var fields = new Array();
      var pair;
      for (var k in values) { 
        pair = values[k].split('=');
        fields[pair[0]] = pair[1];
      }
      document.getElementById('job').value = unescape(fields['job']);
      document.getElementById('recipient').value = unescape(fields['recipient']);
    }
    //]]>
    </script>
    


    Any suggestions or help would be greatly appreciated. Thanks in advance....
      • 4310
      • 2,310 Posts
      Just done some testing and found that it’s &mailselector
      Note the lower case s in selector.
      Using the correct parameter name seemed to work as expected wink
      By the way there is a new beta version of eForm with some enhancements here.
        • 28099
        • 39 Posts
        *facepalm*

        Didn’t even occur to me since that’s how it is shown in the documentation, as well as other parameters having similar case.

        Thanks a ton, David.
          • 4310
          • 2,310 Posts
          My Eform docs show all lowercase.
          Thing is Ditto & Wayfinder do have camel-case parameters so you tend to get used to them laugh
            • 28099
            • 39 Posts
            You are right....

            I originally found this:
            http://modxcms.com/forums/index.php?topic=32481.0

            and then never noticed the lower case in most of the other documentation that I found.

            You’d think I would have learned by now. It always tends to be case or punctuation...

            Thanks again.