We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 47400
    • 21 Posts
    Hi,

    I set up a form a few weeks ago that worked perfectly. Today I have added a new checkbox to it and although the form validates correctly and says that it has submitted, I no longer receive any email with the form responses. I scoured the forums for an answer to this and have tried all of the suggested fixes including the QuickEmail add on which still sends emails fine so there's no problem with emails being sent from the system…

    I tried removing my additions to the form and retested but still no emails sending. I'm using the latest version of formit (formit-2.2.0-pl).

    Can anyone see what I'm missing? Here's my form code:

               
                        <div>
                        [[!FormIt?
                          &hooks=`email`
                          &emailTpl=`form_email`
                          &emailTo=`[email protected]`
                          &emailSubject=`WEBSITE ENQUIRY`
                          &successMessage=`<div class="alert alert-success">
                                  <button type="button" class="close" data-dismiss="alert">×</button>
                                  <p class="lead">Thank you. Your enquiry has been sent.</p>
                              </div>`
                          &validate=`name:required,
                              your_email:email:required,
                              phone:required,
                              comment:required:stripTags,
                              confirm_email:blank,
                              privacy:required`
                        ]]
    
                        [[!+fi.successMessage]]
    
                        <form role="form" action="[[~[[*id]]]]" method="post">
                            <div id="name" class="form-group">
                                <label for="name">Your name: [[!+fi.error.name:notempty=`<p class="text-danger">This is a required field.</p>`]]</label>
                                <input type="text" name="name" class="form-control" value="[[!+fi.name]]">
                            </div>
                            <div id="your_email" class="form-group">
                                <label for="your_email">Your email: [[!+fi.error.your_email:notempty=`<p class="text-danger">This is a required field.</p>`]]</label>
                                <input type="your_email" name="your_email" class="form-control" value="[[!+fi.your_email]]">
                            </div>
                            <div id="confirm_email" class="form-group">
                                <input type="hidden" name="confirm_email" value="" />[[!+fi.error.confirm_email=`<p class="text-danger">Do not fill this field if you are human.</p>`]]
                            </div>
                            <div id="phone" class="form-group">
                                <label for="phone">Your telephone number: [[!+fi.error.phone:notempty=`<p class="text-danger">This is a required field.</p>`]]</label>
                                <input type="text" name="phone" class="form-control" value="[[!+fi.phone]]">
                            </div>
                            <div id="company" class="form-group">
                                <label for="company">Company name: [[!+fi.error.company:notempty=`<p class="text-danger">This is a required field.</p>`]]</label>
                                <input type="text" name="company" class="form-control" value="[[!+fi.company]]">
                            </div>
                            <div id="comment" class="form-group">
                                <label for="enquiry">Your enquiry: [[!+fi.error.comment:notempty=`<p class="text-danger">This is a required field.</p>`]]</label>
                                <textarea name="comment" class="form-control" rows="8" value="[[!+fi.comment]]"></textarea>
                            </div>
                            <div class="checkbox">
                                <label> [[!+fi.error.privacy:notempty=`<p class="text-danger">Please tick to confirm your agreement to our privacy policy and terms & conditions.</p>`]]
                                    <input type="hidden" name="privacy" value="" />
                                    <input type="checkbox" name="privacy" value="agree" [[!+fi.privacy:FormItIsChecked=`agree`]] > Please tick this box to indicate that you understand and agree to our <a href="[[~34]]" title=" Privacy Policy" target="_blank">privacy policy</a> and <a href="[[~19]]" title=" Terms & Conditions" target="_blank">terms & conditions</a>.
                                </label>
                            </div>
                            <div class="form-group">
                                <button type="submit" class="btn btn-default" value="Submit">Submit enquiry</button>
                            </div>
                        </form>
                        </div>
    


    My email tpl code is:

    <p>Name: [[+name]]</p>
     
    <p>Email: [[+your_email]]</p>
    
    <p>Phone: [[+phone]]</p>
    
    <p>Company: [[+company]]</p>
     
    <p>Enquiry: [[+comment]]</p>
    


    Any help greatly appreciated. I'm fairly new to Modx and everything was going great until I came up against this issue sad

    This question has been answered by alanstr84d. See the first response.

      • 3749
      • 24,544 Posts
      Did you re-format the snippet tag? FormIt is sometimes fussy about multi-line arguments. Try putting the validate property all on one line.
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 47400
        • 21 Posts
        Thanks for the quick reply Bob.

        Quote from: BobRay at Jul 01, 2014, 05:06 PM
        Did you re-format the snippet tag?

        Sorry, not sure what you mean by that? I'm still fairly new to Modx and am more of a front end developer so still getting to grips with the more advanced concepts.

        Quote from: BobRay at Jul 01, 2014, 05:06 PM
        FormIt is sometimes fussy about multi-line arguments. Try putting the validate property all on one line.

        I've tried putting the validate properties all on one line but that hasn't fixed it. Can you see anything in my code that might cause issues?

        Do you think I need to scrap the form and start over again? Just confused as to why it was working perfectly before but not now…
          • 47400
          • 21 Posts
          UPDATE:

          I've tried making the form again inside a new chunk and completely left out the additional checkbox so it was more like the original form that worked but still no joy.

          It's odd that Formit was working perfectly a few weeks ago but not now… I haven't updated Modx or Formit but as the site is still under development I'm not sure when the form stopped emailing the enquiries through as I hadn't touched that page until needing to make an addition to the form. Everything still validates fine but no emails are coming through…
            • 3749
            • 24,544 Posts
            You could try doing the same with the success message, but I doubt if that's the issue.

            TBH, I don't use FormIt and have always rolled my own forms, though many people seem to use it successfully. Every time I've tried it, it took so long to get it right that I figured I could create my own form and snippet in less time.

            One more thing to try if you haven't already is to delete all files in the core/cache directory and turn off the compress_js and compress_css System Settings. That's a long shot in your case, but I always try it when something that was working stops working without me making any changes to it. Sometimes it works.

            BTW, here's a Google result with some similar problems. There might be a clue in it somewhere that could help: https://www.google.com/search?q=modx+forums+formit+stopped+working&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a&channel=fflb

              Did I help you? Buy me a beer
              Get my Book: MODX:The Official Guide
              MODX info for everyone: http://bobsguides.com/modx.html
              My MODX Extras
              Bob's Guides is now hosted at A2 MODX Hosting
            • It's also possible that something has been changed with your hosting. Can you send email at all? BobRay's QuickEmail is an excellent email troubleshooting utility. I usually install it as part of my site start-up process so I can test the email system.
              http://bobsguides.com/quickemail-snippet-tutorial.html
                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
                • 47400
                • 21 Posts
                Thanks for the replies guys. Sottwell, yeah I've already tried BobRay's QuickEmail add on, I used it when I originally set up the form. Tried it again yesterday and the emails are still sending from that.

                BobRay, I'll give those other tips a go and cross my fingers but as you say, I think it's going to be a long shot. I had the same thought as you on those Google results and tried reading through most of them before I started the thread. If the answer is in there it's eluding me! I'm starting to think about scrapping FormIt and trying another solution. Any tips for someone who isn't a PHP developer on creating a form?

                Oh, btw, with regards to the success message, I did try removing that and other code related to it at one point with no luck. Really confused why it just stopped working…

                Appreciate the help guys.
                  • 3749
                  • 24,544 Posts
                  There's an issue in another thread where some of the properties in the tag are getting sent to the snippet with the back-ticks included, so FormIt is looking for a hook called `email` instead of email, and not finding it. See if you have anything related to FormIt in the error log when you try to send email.
                    Did I help you? Buy me a beer
                    Get my Book: MODX:The Official Guide
                    MODX info for everyone: http://bobsguides.com/modx.html
                    My MODX Extras
                    Bob's Guides is now hosted at A2 MODX Hosting
                    • 47400
                    • 21 Posts
                    Quote from: BobRay at Jul 03, 2014, 03:55 PM
                    There's an issue in another thread where some of the properties in the tag are getting sent to the snippet with the back-ticks included, so FormIt is looking for a hook called `email` instead of email, and not finding it. See if you have anything related to FormIt in the error log when you try to send email.

                    No errors showing up for Formit in the error log… very strange. The form is validating and returning a success message but there's no errors recorded anywhere I can see and no emails send.

                    Could it be as sottwell suggested and be caused by a hosting issue? I don't think anything has changed with my hosting but if so, should I be asking my hosting provider to find out?

                    Can you think of any other causes that might be causing the emails to fail?
                      • 47400
                      • 21 Posts
                      UPDATE: I just tried FormSave and I'm seeing the form submissions show up in the manager so the issues seems to definitely be email related… not sure if that helps?


                      It's a long shot, but I've just noticed that resource modification times are 1 hour behind in the manager, i.e. I made an update at 10.30am but the resource modification date says 9.30am… could that be a cause for the form email problem? [ed. note: alanstr84d last edited this post 9 years, 10 months ago.]