I have enabled captcha using configuration STORES > Configuration > CUSTOMERS > Customer Configuration > Captcha

I am using one custom form which I used templates directly like below as I have to customize existing contact form on another page. [phtml file]

 <?php echo

Captcha is showing on default page /contact but on my custom page, it is not showing.


 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.

// @codingStandardsIgnoreFile

 <div class="block block-customer">
    <div class="block-title">
            <span class="text"><?php echo __('Contact us') ?></span>
    <div class="block-content">
        <form class="form contact"
              action="<?php /* @escapeNotVerified */ echo $block->getFormAction(); ?>"
              data-hasrequired="<?php /* @escapeNotVerified */ echo __('* Required Fields') ?>"
            <fieldset class="fieldset contactus">
                <div class="field name required">
                    <div class="control">
                        <input placeholder="<?php echo __('Your Name*')?>" name="name" id="name" title="<?php /* @escapeNotVerified */ echo __('Name') ?>" value="<?php echo $block->escapeHtml($this->helper('Magento\Contact\Helper\Data')->getUserName()) ?>" class="input-text" type="text" data-validate="{required:true}"/>
                <div class="field email required">
                    <div class="control">
                        <input placeholder="<?php echo __('Your Email*')?>" name="email" id="email" title="<?php /* @escapeNotVerified */ echo __('Email') ?>" value="<?php echo $block->escapeHtml($this->helper('Magento\Contact\Helper\Data')->getUserEmail()) ?>" class="input-text" type="email" data-validate="{required:true, 'validate-email':true}"/>
                <div class="field telephone">
                    <div class="control">
                        <input placeholder="<?php echo __('Your Phone')?>" name="telephone" id="telephone" title="<?php /* @escapeNotVerified */ echo __('Phone Number') ?>" value="" class="input-text" type="text" />
                <?php echo $block->getLayout()->createBlock('Magento\Cms\Block\Block')->setBlockId('contact-additional-fields')->toHtml();?>
                <div class="field comment required">
                    <div class="control">
                        <textarea placeholder="<?php echo __('Your Message*')?>" name="comment" id="comment" title="<?php /* @escapeNotVerified */ echo __('What’s on your mind?') ?>" class="input-text" cols="5" rows="3" data-validate="{required:true}"></textarea>
                <?php echo $block->getChildHtml('form.additional.info'); ?>
            <div class="actions-toolbar">
                <div class="primary">
                    <input type="hidden" name="hideit" id="hideit" value="" />
                    <button type="submit" title="<?php /* @escapeNotVerified */ echo __('Send Message') ?>" class="action submit primary">
                        <span><?php /* @escapeNotVerified */ echo __('Send Message') ?></span>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.