We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37815
    • 25 Posts
    Hi all, I am using Formit on Modx revolution and everytihg is working ok (emails get sent ok) but it doesn't validate or redirect to the thank you page. I can't see what is wrong can anyone offer any advice?

    The page can be seen here: http://www.fafarts.com/contact

    [[!FormIt?
    &hooks=`email`
    &emailTpl=`sentEmailTpl`
    &emailSubject=`Enquiry from Fafarts.com`
    &emailTo=`[email protected]`
    &redirectTo=`16`
    &validate=`contact_name:required:minLength=`2`,
    contact_email:email:required,
    contact_message:required`
    &hooks=`spam,email`
    &hooks=`recaptcha,spam,email`

    ]]
      • 18373 ☆ A M B ☆
      • 3,141 Posts
      Can you show your snippet call, chunks etc?
        Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

        Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
        • 37815
        • 25 Posts
        snippet call:
        [[!FormIt?
        &hooks=`email`
        &emailTpl=`sentEmailTpl`
        &emailSubject=`Enquiry from Fafarts.com`
        &emailTo=`[email protected]`
        &redirectTo=`16`
        &validate=`contact_name:required:minLength=`2`,
              contact_email:email:required,
              contact_message:required`
        &hooks=`spam,email`
        &hooks=`recaptcha,spam,email`
        
        ]]


        Email chunk:
        [[+contact_name]] left you the message below Faf Arts website: <br />
        <strong>[[+contact_message]]</strong><br />
        You can respond to [[+contact_name]] by email at <a href="mailto:[[+contact_email]]">[[+contact_email]]</a>
          • 18373 ☆ A M B ☆
          • 3,141 Posts
          &hooks=`spam,email`
          &hooks=`recaptcha,spam,email`


          That's not right.

          1) You should specify it only once. You'll probably see that only the last value is used, so the first is obsolete.
          2) You're never telling it when to redirect or validate. Validation and Redirection is another hook in itself, so you need to add that in the &hooks property. Assuming you'd want to first validate the form, than the recaptcha, then check for spam, then send the email and finally redirect this is what your &hooks property would look like:
          &hooks=`validate,recaptcha,spam,email,redirect`


          See http://rtfm.modx.com/display/ADDON/FormIt.Hooks for more information. Another thing there you can find on the spam hook is that it defaults to checking the "email" field for known spam emails. However you named your email field "contact_email" so you'd want to set another "spamEmailFields" property with that. http://rtfm.modx.com/display/ADDON/FormIt.Hooks.spam


          This can also become an issue:
          &validate=`contact_name:required:minLength=`2`,
                contact_email:email:required,
                contact_message:required`

          The nested `` (with the minLength) can tick off the parser. Instead you can use this which bypasses that:
          &validate=`contact_name:required:minLength=^2^,
                contact_email:email:required,
                contact_message:required`
            Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

            Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
            • 37815
            • 25 Posts
            hi Mark, thank you so much for you help with this. I am literally just starting out with Modx so I appreicate the help! I have added in the code as you suggest:

            [[!FormIt?
            &hooks=`email`
            &emailTpl=`sentEmailTpl`
            &emailSubject=`Enquiry from Fafarts.com`
            &emailTo=`[email protected]`
            &redirectTo=`16`
            &validate=`contact_name:required:minLength=^2^,
                  contact_email:email:required,
                  contact_message:required`
            &hooks=`validate,recaptcha,spam,email,redirect`
            
            ]]
            but still having no joy. An I doing something else wrong now?
              • 37815
              • 25 Posts
              Oh hang on - its working now! Thank you so much. smiley
                • 18373 ☆ A M B ☆
                • 3,141 Posts
                Great! smiley Your welcome!
                  Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

                  Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
                  • 37815
                  • 25 Posts
                  Oh no, hang on - the recapture validation is working now and it goes to the thank you page. But it doesn't check the other bits, the name and email. If you leave them blank it just reloads the blank page with no error message...?
                    • 18373 ☆ A M B ☆
                    • 3,141 Posts
                    For me it only submits when I fill in everything. It only shows the recaptcha error tho.

                    Can you show the form's HTML?
                      Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

                      Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
                      • 18373 ☆ A M B ☆
                      • 3,141 Posts
                      You're not telling it where to display the error.. you are doing that for the recaptcha field with this:
                          [[!+fi.error.recaptcha]]


                      Simply place these placeholders near the other fields where you want errors to appear:
                          [[!+fi.error.contact_name]]
                          [[!+fi.error.contact_email]]
                          [[!+fi.error.contact_message]]
                      
                        Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

                        Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.