I have created my custom arithmetic captcha. I want add that captcha to my custom form through xml file without defining in phtml file on custom layout. For example:

Testimonail submit form: testimonial_form.phtml file contains

  <form name="testimonial" action="testimonial/post/index" method="post">

 <input type="text" name="name" />
 <!--  I want captcha here through XML --!-->

<input type="submit" value="submit" />  

I want to add my custom captcha through xml before th submit button. How can i do that?

Any help would be appreciated.


Create a container for that. You can check here, how to create that

Now you can use it inside your phtml:

<?= $block->getChildHtml('form.additional.info') ?>

Your configuration is done. Now you can add separate XML with name form.additional.info for captcha.

  • Thank you sohel Rana sir. I have created container inside my block of that form file and called this childHtml thing in template I need to create <referenceContainer or <referenceBlock for this? – Jackson Wyss Feb 19 '19 at 5:15
  • Now create referenceContainer for this. – Sohel Rana Feb 19 '19 at 5:33
  • Thank you very much sir. I am privilaged to have your response . It helped me. Can you help me sir with following as well: magento.stackexchange.com/questions/262515/… – Jackson Wyss Feb 19 '19 at 16:59

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.