I have created a module to display the Magento native captcha in the contact form and it is working fine on my localhost. But when I upload it on the server it is showing the following error

Fatal error: Call to a member function getBlockName() on a non-object in /public_html/app/code/core/Mage/Captcha/Block/Captcha.php on line 43

I have tried some methods like clearing the cache and session files.

What can I do to resolve this?

closed as off-topic by Marius May 6 '15 at 7:44

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions on problems in code you've written must describe the specific problem and include valid code to reproduce it. For help writing short, self-contained syntactically-valid examples, see: http://sscce.org/" – Marius
If this question can be reworded to fit the rules in the help center, please edit the question.


Captcha requires a form id which is given in captcha layout file, the code is used as

<action method="setFormId"><formId>contact_form</formId></action>

you can follow this tutorial Captcha for contact us.

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