ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Captcha not matching

October 01, 2009 7:09pm

Subscribe [2]
  • #1 / Oct 01, 2009 7:09pm

    Peter Lewis

    280 posts

    I’ve come to the conclusion that captcha’s really don’t like me :(

    Everytime I submit the contact form (that is also a Freeform form) I get:

    The captcha word you submitted is incorrect. Please go back and try again.

    and no, I’m not that bad a speller.

    You can experience it yourself here

    My code:

    {if captcha}
                            <em>Spam prevention question:</em> {captcha}
                            <label for="captcha">Answer<noscript><em>*</em></noscript></label>
                            <input id="captcha" name="captcha" type="text" class="required" value="" title="Enter the correct answer to the question" />
    {/if}

    I’ve tried with and without the “if captcha” line.
    Tried logged in and logged out.
    Disabling all extensions.
    Different browsers
    I’ve tried “Enable CAPTCHAs for Tell-a-Friend and Contact emails”
    I’ve treble checked the paths and directory permissions
    “Require captcha with logged-in members?” is set to yes
    “Add Random Number to Captcha Word” and “Use TrueType Font for Captcha?” tried all combinations.
    I’ve even cleared the cache.

    There is a version that works on the registration form on the same site no problem.

    Ironically it was working when I first set it up and it is working on another site I’ve just finished with exactly the same setup and code (Contact form using Freeform).

    v1.6.8 of EE.

    Oddly, everytime (although I’ve got the error), it is still stored fine in FreeForm (v2.7.1) - yeap I know if it’s a freeform problem you can’t help, but it’s the EE Captcha that’s giving me the grief.
    Also oddly, if I disable JavaScript it doesn’t complain.

    Any help or ideas would be appreciated.

    Peter.

  • #2 / Oct 02, 2009 1:34am

    John Henry Donovan

    12339 posts

    Twobelowzero,

    Can you make the addition of {captcha_word} in the value parameter

    {if captcha}
                            <em>Spam prevention question:</em> {captcha}
                            <label for="captcha">Answer<noscript><em>*</em></noscript></label>
                            <input id="captcha" name="captcha" type="text" class="required" value="{captcha_word}" title="Enter the correct answer to the question" />
    {/if}

    The only place you would not use this parameter for captcha is in the member registration form

  • #3 / Oct 02, 2009 5:42am

    Peter Lewis

    280 posts

    Hi John,

    Nope that doesn’t work I’m afraid, it simply displays “{captcha_word}” in the input box (as you can see in the current site linked on earlier post).

    Here’s the form header code:

    {exp:freeform:form form_name="contact" form_id="contact-form" send_user_email="no" notify="<removed>" template="contact" required="fullname|email|enquiry" return="/contact/result"}

    Is it worth trying it with a standard form entry?  I’ve just updated freeform to version 2.7.2 and it still occurs.

    Just to make things more confusing, here’s a copy of the code used on the site that is working:

    {assign_variable:default-text="required"}
    {if captcha}
            {captcha}
            <label for="captcha">Answer<noscript><em>*</em></noscript></label>
            <input id="captcha" name="captcha" type="text" value="" title="Enter the correct answer to the question" />
    {/if}

    Which is identical to the site that doesn’t work, hence why I think it may be some setting in the back-end that causing issue.

    Working code taken from: http://www.pallantbookshop.com/contact/

    Many thanks,

    Peter

  • #4 / Oct 02, 2009 5:53am

    Peter Lewis

    280 posts

    Right, I’ve ripped out Freeform and using the standard contact form built into EE, it’s doing all the same things (it’s made no difference - same problem is occuring).

    Here’s a complete copy of the form:

    {assign_variable:default-text="required"}
                    {!-- exp:freeform:form form_name="contact" form_id="contact-form" send_user_email="no" notify="<removed>" template="contact" required="fullname|email|enquiry" return="/contact/result" --}
    {exp:email:contact_form user_recipients="false" recipients="<removed>" return="{site_url}/contact/result" charset="utf-8"}
                        <fieldset>
                            <legend>Enquiry: Your details</legend>
                            <label for="fullname">Name<noscript><em>*</em></noscript></label>
                            <input id="fullname" name="fullname" class="required" type="text" value="{default-text}" notequal="{default-text}">
                            <label for="email">Email<noscript><em>*</em></noscript></label>
    {!--                        <input id="email" class="required email" name="email" type="text" value="{default-text}" notequal="{default-text}"> --}
                            <input id="email" class="required email" name="from" type="text" value="{default-text}" notequal="{default-text}">
                            <label for="address">Address</label>
                            <textarea id="address" name="address" rows="6" cols="40" ></textarea>
                            <label for="postcode">Postcode</label>
                            <input id="postcode" name="postcode" type="text" value="" />
                            <label for="phone">Phone</label>
                            <input id="phone" name="phone" type="text" value="" />
                            <label for="enquiry" id="enquiry-label">Enquiry<noscript><em>*</em></noscript></label>
    {!--                        <textarea id="enquiry" class="required" name="enquiry" rows="6" cols="40" notequal="{default-text}">{default-text}</textarea> --}
                            <textarea id="enquiry" class="required" name="message" rows="6" cols="40" notequal="{default-text}">{default-text}</textarea>
                            <noscript><label class="required-msg"><em>*</em>required fields</label></noscript>
                            <label for="newsletter-signup" id="newsletter-label">
                                <input id="newsletter-signup" name="newsletter" type="checkbox" value="yes" checked="checked" />
                                Yes, please send me updates about special offers and promotions</label>
                            <noscript><div class="hidden"><input id="no-javascript" name="no_javascript" type="checkbox" value="yes" checked="checked" /></div></noscript>
    {if captcha}
                            <em>Spam prevention question:</em> {captcha}
                            <label for="captcha">Answer<noscript><em>*</em></noscript></label>
                            <input id="captcha" name="captcha" type="text" class="required" value="{captcha_word}" title="Enter the correct answer to the question" />
    {/if}
                            <label id="contact-privacy-link">View our <a href="/privacy_policy">Privacy policy</a></label>
                            <button type="submit"><span><em>Send</em></span></button>
                        </fieldset>
                    {!-- /exp:freeform:form --}
    {/exp:email:contact_form}
  • #5 / Oct 02, 2009 5:56am

    Peter Lewis

    280 posts

    I’ve also removed the JavaScript validation.

    EDIT: I’ve moved the page now so it can’t be seen from the main site, it can be accessed here:
    http://www.netcurtaincorner.co.uk/contact-test/

    The error message I get is:
    “You did not submit the word exactly as it appears in the image”

    This is the clean version of the form that still doesn’t work:

    {exp:email:contact_form user_recipients="false" recipients="[email protected]" return="{site_url}contact/result" charset="utf-8"}
        <fieldset>
            <legend>Enquiry: Your details</legend>
            <label for="fullname">Name<noscript><em>*</em></noscript></label>
            <input id="fullname" name="fullname" type="text" title="Enter your name" />
            <label for="email">Email<noscript><em>*</em></noscript></label>
            <input id="email" name="from" type="text" title="Enter a valid email address" />
            <label for="enquiry" id="enquiry-label">Enquiry<noscript><em>*</em></noscript></label>
            <textarea id="enquiry" name="message" rows="6" cols="40" title="Enter your enquiry">{default-text}</textarea>
    {if captcha}
            <em>Spam prevention question:</em> {captcha}
            <label for="captcha">Answer</label>
            <input id="captcha" name="captcha" type="text" value="{captcha_word}" title="Enter the correct answer to the question" />
    {/if}
            <button type="submit"><span><em>Send</em></span></button>
        </fieldset>
    {/exp:email:contact_form}
  • #6 / Oct 04, 2009 9:49am

    John Henry Donovan

    12339 posts

    Peter,

    Do you still have the Accessible Captcha extension installed?

    On your contact test page, can you just leave your contact form code and remove everything else from the template. This way we can rule out anything template side interfering with it.

  • #7 / Oct 04, 2009 10:44am

    Peter Lewis

    280 posts

    Thanks for the reply John.

    No, Accessible Captcha is disabled.

    But by stripping it down, then re-introducing each element, I’ve got it down to an offending JavaScript file.  Which I find odd as it’s JavaScript, not server-side.  I’ll feedback here when I’ve identified the problem further.

  • #8 / Oct 04, 2009 11:17am

    Peter Lewis

    280 posts

    OK, the JavaScript was triggering an Ajax call to a module (stupidly the JS was targetting all form input changes, instead of the specific form it was to be used with).

    Oddly though the module in question was simply returning because the incorrect template tags weren’t set.

    So why this allows the email to be sent and the information to be stored in the database, but then returned the error regarding Captcha…?  I suppose we’ll never know.

    Maybe the module should be returning something on failure instead of just “return;”.

    Thanks for all your help, sorry to have wasted your time, but it is very appreciated and at least we solved it.

  • #9 / Oct 04, 2009 3:31pm

    John Henry Donovan

    12339 posts

    Glad you are up and running again. Feel free to start a new thread if you have any more questions.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases