Organizational Research By

Surprising Reserch Topic

magento add captcha to custom contact form


magento add captcha to custom contact form  using -'magento,customization,captcha,contact-form'

I created a new custom contact form in Magento website, I am trying to add captcha at the end of it.

I have added to app/code/core/Mage/Captcha/etc/config.xml

                <customcontacts>
                    <label>Custom Contact Form</label>
                </customcontacts>


And I added to app/design/frontend/base/default/layout/captcha.xml

    <customcontacts>
    <reference name="customcontacts">
        <block type="core/text_list" name="form.additional.info">
            <block type="captcha/captcha" name="captcha">
                <reference name="head">
                    <action method="addJs"><file>mage/captcha.js</file></action>
                </reference>
                <action method="setFormId"><formId>customcontacts</formId></action>
                <action method="setImgWidth"><width>230</width></action>
                <action method="setImgHeight"><width>50</width></action>
            </block>
        </block>
    </reference>
</customcontacts>


And I added to my form this code:

<script type="text/javascript">
//<![CDATA[
$('form-validate-captcha').captcha.refresh($('catpcha-reload'));
//]]>




And I added this code to show the Captcha:

<div><?php echo $this->getChildHtml('captcha'); ?></div>


Then I enabled Captcha in Configuration > Customer Configuration > CAPTCHA and I choose "Custom Contact Form" then "Displaying Mode" to "Always".

But I still didn't get the Captcha at my custom form yet.

I hope I was clear

Thanks
    
asked Oct 7, 2015 by atulpariharmca
0 votes
117 views



Related Hot Questions



Government Jobs Opening

Further down in the same template/contacts/form.phtml file, add in the new field to the form itself:

  • Note the validate-people text is the same in attribute as well as in the javascript function we added above.

    End result: enter image description here

    answered Oct 7, 2015 by tushar2k6

    ...