We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 43621
    • 40 Posts
    Hi. Today I've started a new Form, registered a new recaptcha key and updated modx with the new keys.

    While testing my Form I noticed, that the form doesn't send any mail if I entered something wrong inside a required field. So everything works nicely. But the FormIt sends mails, though the recaptcha is entered wrong - the error message appears, the page simply reloads (no redirect to my set up page).

    Can someone help me to "debug" that problem?

    [[!FormIt? &hooks=`spam, email, redirect, recaptcha` &redirectTo=`67` &recaptchaTheme=`white` &emailTpl=`email-tpl` &emailSubject=`(website)` &emailTo=`xxxxx.com` &validate=`name:required, email:email:required, message:required`]]
    
    <form style="padding: 0 20px 20px 20px;" class="form" action="[[~[[*id]]]]" method="post">
      <input type="hidden" name="workemail" value="" />
      <p class="title_contact">Name</p>
      <p class="input_content">
        <input id="name" type="text" name="name" value="[[!+fi.name]]" />
        <br />
        <span class="error">[[!+fi.error.name]]</span></p>
      <p class="title_contact" style="clear:left;">Email</p>
      <p class="input_content">
        <input id="email" type="text" name="email" value="[[!+fi.email]]" />
        <br />
        <span class="error">[[!+fi.error.email]]</span></p>
      <p class="title_contact" style="clear:left;">Telefon</p>
      <p class="input_content">
        <input id="phone" type="text" name="phone"  value="[[!+fi.phone]]" />
        <br />
        <span class="error">[[!+fi.error.phone]]</span></p>
      <p class="title_contact" style="clear:left;">Titel</p>
      <p class="input_content">
        <input id="title" type="text" name="title" value="Interesse an: [[*fr-title]]" />
        <br />
        <span class="error">[[!+fi.error.title]]</span></p>
      <p class="title_contact" style="clear:left;">Nachricht</p>
      <p class="input_content">
        <textarea id="message" type="text" name="message" value="[[!+fi.message]]">[[!+fi.message]]</textarea>
        <br />
        <span class="error">[[!+fi.error.message]]</span></p>
      <div style="clear: both;"> </div>
    
    
      <p><small>Geben Sie bitte zur Sicherheit folgenden ein:</small></p>
      [[+formit.recaptcha_html]]
      <p>[[!+fi.error.recaptcha]]</p>
    
    
      <input class="button" type="submit" value="Absenden" />
      <div style="clear: both;"></div>
    </form>
    
      


    I used FormIt 2.2.0 and still doesnt work with 2.2.1., Revo 2.3.1


    ---------------

    The other thing I don't know how to update is, that the new "I'm not a Robot" design is used (especially cause my site is responsive and should be mobile-friendly)

    Thx in advance smiley

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

      • 43621
      • 40 Posts
      small push. does really nobody know what to do? sad
      • discuss.answer
        • 30585
        • 833 Posts
        Change your Formit call to this:

        [[!FormIt? &hooks=`recaptcha,spam,email,redirect` &redirectTo=`67` &recaptchaTheme=`white` &emailTpl=`email-tpl` &emailSubject=`(website)` &emailTo=`xxxxx.com` &validate=`name:required, email:email:required, message:required`]]
        


        Formit executes hooks in the order they are specified in the property. The redirect hook should always be specified last. Your problem is that you're firing the email hook before the recaptcha hook runs. You're also redirecting before recaptcha is fired. This is most likely the reason you're having those issues
        [ed. note: treigh last edited this post 11 years, 7 months ago.]
          A MODx Fanatic
          • 43621
          • 40 Posts
          Thanks for that, exactly the solution I needed smiley



          -> Now only the "I'm no Robot" theme is my last problem smiley If someone can help there! Cheers
            • 30585
            • 833 Posts
            Glad I could help. I haven't looked into theming reCaptcha2. Maybe someone else can help here.
              A MODx Fanatic