We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 12410
    • 353 Posts
    Modx Revo 2.2.13
    Formit 2.2.0
    Public and Private keys added to System Settings

    Hi Guys,
    Using the below code the email sends on submit despite the recaptcha failing validation. Any ideas please?
    Thanks

    	[[!FormIt?
       &hooks=`email,recaptcha`
       &recaptchaTheme=`white`
       &emailFrom=`[email protected]`
       &emailTpl=`whatever-email`
       &emailTo=`[email protected]`
       &emailSubject=`Website Query`
       &validate=`name:required,
          email:email:required,
          comment:required:stripTags`
          &successMessage=`<div class="alert done"><b>Email Sent! We will respond shortly. Thank you!<b></b></div>`
        
    ]]
     
    
         
        [[!+fi.successMessage]]
     
     
    
    
     
     
        <form id="whatever-form" action="[[~[[*id]]]]" method="post">
            
                <div class="controls">
                  <div class="[[!+fi.error.name:notempty=`alert warning`]]" id="name">Name: [[!+fi.error.name:notempty=`↓ This is a required field.`]]</div> 
    			  <input type="text" name="name" value="[[!+fi.name]]">
                
            </div>
     
           
                
    			<div class="controls">
                  <div class="[[!+fi.error.email:notempty=`alert warning`]]" id="email"><label for="email">Email: [[!+fi.error.email:notempty=`↓ This is a required field.`]]</div>
    			  <input type="text" name="email" value="[[!+fi.email]]">
    			 
                </div>
            
     
            	
                
                <div class="controls">
                   <div class="[[!+fi.error.comment:notempty=`alert warning`]]" id="comment">Message: [[!+fi.error.comment:notempty=`↓ This is a required field.`]]</div> 
    			   <textarea name="comment" id="comment" value="[[!+fi.comment]]">[[!+fi.comment]]</textarea>
    			
                </div>
            Captcha Security Code:
        [[+formit.recaptcha_html]]
        [[!+fi.error.recaptcha:notempty=`<div class="alert warning">↑ Please input captcha code accurately.</div>`]] <br />
            <a class="button black" href="javascript:{}" onclick="document.getElementById('whatever-form').submit(); return false;"> Send</a>
     
     
        </form>

      • 37747
      • 50 Posts
      Same issue, I get the "The reCAPTCHA wasn't entered correctly. Go back and try it again." validation message but email sends anyway.
      Revo 2.2.6
      Formit 2.2.0
        • 25330
        • 14 Posts
        Have you tried changing the order of your hooks? It looks like your formit call will run the email hook before the recaptcha.

        Try changing line 2.
        &hooks=`recaptcha,email`
          • 37246
          • 128 Posts
          +1 for LaSota
            I LOVE MODX! | greyskymedia.com