Extension

Developer
Supported

Snaptcha

ExpressionEngine 2, ExpressionEngine 3, ExpressionEngine 4, ExpressionEngine 5

Back to this add-on's main page
View Other Add-ons From PutYourLightsOn

     

You must be logged in to post.

Getting an error when testing form on site at all Security levels

Support (Resolved)

5BYFIVE
5BYFIVE

I have a client site with 3 simple forms, I installed Snaptcha and it appears to be working with 2 out of the 3 forms. At least I can submit successfully to 2 of the forms, the third gives an error….

================

The form you submitted contained the following errors
Sorry, you have failed the security test. Please ensure that you have javascript enabled and that you refresh the page that you are trying to submit.
Return to Previous Page

==================

I tried all 3 security levels and get the same error. Shouldn’t be an issue with javascript being enabled on my browser. Any ideas?  Thanks!

EE v3.5.6
Snaptcha v2.2.0

PutYourLightsOn
# 1
Developer
PutYourLightsOn

What type of forms are each of the 3 you are testing? And is there anything obvious that differentiates the one that does not work from the two that do?

5BYFIVE
# 2
5BYFIVE

Ben, there are 3 forms, here are some details…All 3 forms are hard-coded in the template, rather than using the freeform composer. I don’t see many differences. #3 is the form that won’t submit successfully. I do see I’m using freeform tags to generate the form fields instead of hard-coding them. Not sure if that would affect Snaptcha…No errors in the browser console. Thanks for your help!

================================

1. Coupon Subscribe - Name(text), Email(text), Phone(text), Subscribe to Email(checkbox) fields - Link at top of the page that opens a modal with the form. Uses Subscriber plugin to subscribe user to Campaign Monitor if they checkoff box.

{exp:freeform:form
     form_name
="coupon_subscribe"
     
return="coupon"
     
required="name|email|phone"
     
inline_errors="false"
     
form:id=""
   
}
  
   {exp
:subscriber:form form_id="1"}
     
<p>
     <
label for="name">Name*</label>
       <
input type="text" name="name" value="" id="freeform_name" maxlength="150" tabindex="1">
     </
p>
     <
p>
     <
label for="name">Phone Number*</label>
       <
input type="text" name="phone" value="" id="freeform_phone" maxlength="150" tabindex="2">
     </
p>
     <
p>
     <
label for="name">Email Address*</label>
       <
input type="text" name="email" value="" id="freeform_email" maxlength="150" tabindex="3">
     </
p>
     <
p>
       <
input type="checkbox" name="switch" id="freeform_optin" value="yes" checked="true">
     <
label for="switch">YesI would like to subscribe to Newsletter</label
     </
p>
     
     <
input type="submit" name="" value="Submit »" class="button style2" tabindex="4">
   
   
{/exp:freeform:form} 

================================

2. eNewsletter Subscribe - Email(text) field - form at bottom of every page in footer. Uses Subscriber plugin to subscribe user to Campaign Monitor

{exp:freeform:form
     form_name
="emailer_subscribe"
     
return="thank-you"
     
required="email"
     
inline_errors="false"
     
form:id="subForm"
   
}

   {exp
:subscriber:form form_id="2"}
    
<input id="fieldEmail" name="email" type="email" placeholder="Email Address" required />
    <
input type="submit" value="Signup" />   
   
{/exp:freeform:form} 

================================

3. Contact Page form - Name(text), Email(text), Phone(text), Message(textbox) fields

{exp:freeform:form
     form_name
="contact"
     
return="contact/thank-you"
     
required="name|email|phone|message"
     
inline_errors="false"
     
form:id="contact"
    
}
    
     
<p>
     <
label for="full_name">Name*</label>
       
{freeform:field:name attr:tabindex="1"}
       {if freeform
:error:name}
        
<span class="error">Please provide your full name.</span>
       
{/if}
     
</p>
     <
p>
      
     <
label for="name">Email Address*</label>
       
{freeform:field:email attr:tabindex="2"}
       {if freeform
:error:email}
        
<span class="error">Please provide your email address in a valid format.</span>
       
{/if}
     
</p>

     <
p>
     <
label for="phone">Phone Number*</label>
       
{freeform:field:phone attr:tabindex="3"}
       {if freeform
:error:phone}
        
<span class="error">Please provide your phone number.</span>
       
{/if}
     
</p>

     <
p>
     <
label for="user_message">Message (If requesting an appointmentplease indicate which location you prefer.)</label>
       
{freeform:field:user_message attr:tabindex="4"}
     
</p>

     <
input type="submit" name="" value="Send Your Information »" class="button style2" tabindex="5">

    
{/exp:freeform:form} 
PutYourLightsOn
# 3
Developer
PutYourLightsOn

Ok so we’re talking about “Freeform” forms. It’s helpful to see the code but I also cannot spot anything obvious.

Can you open the browser console and look for the Snaptcha field that is automatically added to the form? It should be called `snap_` followed by a random string, unless you changed the prefix in the settings. If all looks good then you can email me the link to the form and I’ll take a closer look.

5BYFIVE
# 4
5BYFIVE

Ben, I setup a dev site to work on today, but it tested ok. So I tried the live site again and it seemed to work ok. One thing I did differently is used different email addresses while testing. Is it possible that using the same email address in quick succession triggered things? Anyway, it’s working for now, I’ll let you know if things start acting wonky for my client, thanks!

PutYourLightsOn
# 5
Developer
PutYourLightsOn

The email address you use should not make any difference. What may have been happening is that you were using the back button to return to the form after submitting it, without refreshing the page. That would not allow the Snaptcha field to be regenerated and therefore the form submission would fail.

Glad to hear it’s working now and let me know if you come across any other issues.