We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18640
    • 9 Posts
    I wonder if anyone can help with this; I have set up a contact form with checkbox options. Anyone know how to get checkbox values in the email response?.
    Here is the code;

    [+validationmessage+]
    <form method="post" action="[~[*id*]~]">

    <input type="hidden" name="formid" value="eContactForm" />

    <p><label accesskey="n" for="Name">Full Name: </label>
    <input type="text" name="Name" maxlength="60" eform="Your Name::1:Expected at least two words:#REGEX /^\w+\s\w+/i" /></p>

    <p><label for="Address" >Address: </label>
    <input type="text" name="address" size="40" maxlength="100" eform="Your Address:address:1" /></p>

    <p><label for="Town" >City/Town: </label>
    <input type="text" name="town" size="40" maxlength="40" eform="Your Town:town:1" /></p>

    <p><label for="County" >County: </label>
    <input type="text" name="county" size="40" maxlength="40" eform="Your County:county:1" /></p>

    <p><label for="postcode">Postcode: </label>
    <input type="text" name="postcode" size="40" maxlength="40" eform="Postcode:postcode:1" /></p>

    <p><label accesskey="e" for="email">Email: </label>
    <input type="text" name="email" size="40" maxlength="40" eform="Your Email Address:email:1" /></p>

    <p><label accesskey="t" for="tel">Telephone Number: </label>
    <input type="text" name="tel" size="40" maxlength="40" eform="Your Telephone Number:tel:1" /></p>


    <h1>Interested In:</h1>
    <table id="interest">
    <tr>
    <td width="30%">Windows</td>
    <td width="15%"><input name="interest[" type="checkbox" eform="Your interest:Interest-windows" value="Windows" /></td>
    <td width="48%">Steel</td>
    <td width="7%"><input name="material[" type="checkbox" eform="Your interest:Interest-steel" value="Steel" /></td>


    </tr>
    <tr>
    <td>Conservatories</td>
    <td><input name="interest[]" type="checkbox" value="Conservatories" /></td>
    <td>Aluminium</td>
    <td><input name="material[]" type="checkbox" value="Aluminium" /></td>
    </tr>
    <tr>
    <td>Fascias</td>
    <td><input name="interest[]" type="checkbox" value="Fascias" /></td>
    <td>Timber</td>
    <td><input name="material[]" type="checkbox" value="Timber" /></td>
    </tr>
    <tr>
    <td>Repairs</td>
    <td><input name="interest[]" type="checkbox" value="Repairs" /></td>
    <td>PVC</td>
    <td><input name="material[]" type="checkbox" value="PVC" /></td>
    </tr>
    <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>Secondary Glazing</td>
    <td><input name="material[]" type="checkbox" value="Secondary Glazing" /></td>
    </tr>
    <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>Timber/Aluminium Composite </td>
    <td><input name="material[]" type="checkbox" value="Timber/Aluminium Composite" /></td>
    </tr>
    </table>


    <p><label accesskey="c" for="comments">Comments: </label>
    <textarea cols="40" rows="8" name="comments" eform="Comments:html:1"></textarea></p>

    <p>
    Please enter the anti spam code below:

    <img src="[+verimageurl+]" alt="verification code" border="1"/>
    </p>
    <p>
    <label accesskey="c" for="vericode">Enter the code here:</label>
    <input type="text" name="vericode" size="20" />


    <input class="btn" type="submit" name="submit" value=" Send "/></p>
    </form>
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      The "docs" folder in assets/snippets/eform contain example forms that show how to do this.
        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
        • 18640
        • 9 Posts
        I cant find anything in those examples that is specific to my problem. This is the email response I am currently getting;

        This is a response sent by kn ioj ij using the contact form on the website. The details of the message follow below:
        Name: kn ioj ij
        Address: ij;ji
        City/Town: jij
        County: jij
        Postcode: ijoijiojio
        Email: test@test
        Tel: 798798
        Comments: sdfgdsgsdg
        Windows:
        Steel:

        The ’Windows’ and ’Steel’ sections are the checkboxes, when a customer ticks the specific product I am trying to get the number ’1’ to appear. At the moment no value is appearing, they just remain blank as you can see.
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          I don’t see any eform="..." attributes on any of those checkbox fields.
            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
            • 18640
            • 9 Posts
            Can you give an example of how that should be formatted please?

            Thanks
              • 18640
              • 9 Posts
              Quote from: sottwell at Jul 07, 2009, 10:23 AM

              I don’t see any eform="..." attributes on any of those checkbox fields.

              Im still having trouble with this, where exactly should the eform attributes be placed?.
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                  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
                  • 18640
                  • 9 Posts
                  Thanks for the feedback everyone, Ive finally got it working.
                    • 28625
                    • 24 Posts
                    Example:
                    <label for="variableName01">
                    	<input type="checkbox" name="variableName[]" id="variableName01" value="Label" eform="variableName01::1" />
                    	Label</label>
                    <br/>
                    <label for="variableName02">
                    	<input type="checkbox" name="variableName[]" id="variableName02" value="Label" />
                    	Label</label>
                    

                    Using the "[]" after your variable name is the key. The "name" stays the same for each option, but you probably already know that! On the eform value, delete the 1 at the end if it’s not a required field. You only need this for the first checkbox option. Then in the report for your email use [+variableName+].
                      • 20710
                      • 65 Posts
                      Quote from: Matt at Jul 14, 2009, 09:25 AM

                      Thanks for the feedback everyone, Ive finally got it working.

                      How? . . . . . Please?