We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 27541
    • 29 Posts
    CMS / MODx / eForm newbie here...
    I’ve set up eForm for my site, but there’s no validation happening, and the report isn’t being sent. I suspect the problem may be that I’ve tried to use a very simple alternative to CAPTCHA - a field (hidden using CSS) that is meant to remain empty, and I’m trying to use eForm’s validation for this. I’ve pasted my form chunk code below. Any help would be greatly appreciated, thank you.

    <form method="post" id="contactForm" action="[~1~]">
    <p>[+validationmessage+]</p>
    <fieldset><ul>
    <li class="noshow"><label for="url">Spam ID (leave blank):</label><input type="text" name="url" id="url" class="textfield" eform="SpamId:string:1::#LIST " /></li>
    <li><label for="name">Name:</label><input type="text" name="name" id="name" class="textfield" eform="Name:string:1:Please enter your name" /></li>
    <li><label for="email">E-mail:</label><input type="text" name="email" id="email" class="textfield" eform="Email:email:1:Please enter your e-mail address" /></li>
    <li><label for="comment">Question
    or Comment:</label><textarea rows="4" cols="40" name="comment" id="comment" eform="Comment:string:1:Was there something you wanted to say?"></textarea></li>
    <li><input class="btn_submit" type="submit" value="Send" /></li>
    </ul></fieldset>
    </form>
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      I have that working on my demo site, http://www.sottwell.com. You can log in to the manager and see how I did it. The form in question is on the Contact page.

        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
        • 27541
        • 29 Posts
        Thank you for that -- very nice to see it done. So I’ve used the same eForm attribute as you have, and I still get no validation & no report. I switched on the debug output, but I’m not seeing anything obviously wrong. Any ideas?

        Also, another question... I’m not clear on how the &thankyou works if it’s pointed at a chunk. Where does it display the thank you content?

        Thanks,
        ST
          • 30223
          • 1,010 Posts
          The &thankyou parameter will after a successful submit simply display the thankyou chunk instead of the form. Using placeholders you can display values from the form in your thankyou chunk.


          It would be helpful if you also posted the eform snippet call, with only your form template it’s difficult to see if anything is wrong. You do have your eForm call on the page with id=1 I hope?
            • 27541
            • 29 Posts
            yes, of course -- i’ve pasted both the form code and the call below. the form appears in the footer on all pages. so, the form code below is a chunk, and the call lives in another chunk called "footer". i’m guessing i should change the form attribute action back to "[~{*id*]~]? not sure if that matters -- i had it that way originally, but it didn’t solve the validation problem.

            thank you.
            ...................................

            <form method="post" id="contactForm" action="[~1~]">
            <p>[+validationmessage+]</p>
            <fieldset><ul>
            <li class="noshow"><label for="url">Spam ID (leave blank):</label><input type="text" name="url" id="url" class="textfield" eform="Spam::0" /></li>
            <li><label for="name">Name:</label><input type="text" name="name" id="name" class="textfield" eform="Name:string:1:Please enter your name" /></li>
            <li><label for="email">E-mail:</label><input type="text" name="email" id="email" class="textfield" eform="Email:email:1:Please enter your e-mail address" /></li>
            <li><label for="comment">Question
            or Comment:</label><textarea rows="4" cols="40" name="comment" id="comment" eform="Comment:string:1:Was there something you wanted to say?"></textarea></li>
            <li><input class="btn_submit" type="submit" value="Send" /></li>
            </ul></fieldset>
            </form>
            ...............................................
            the call:
            [!eForm? &formid=’contactForm’ &tpl=`eFormContact` &report=`eFormContactReport` &to=`[email protected]` &subject=’Website Comment from [+name+]’ &thankyou=’eFormThanks’ &debug=’1’ !]
              • 30223
              • 1,010 Posts
              Not surprised it didn’t work... you have mixed "single quotes" (’) and "back quotes" (`) in your snippet call. You should only use back quotes.
                • 27541
                • 29 Posts
                ah, i see! now working fine. obviously, i’m new to mySQL/PHP as well! had no idea about the back tics, sorry. thanks for your help.