I've been trying to add Captcha to one of my node types, e.g. advpoll_binary. At first I thought it would be easy by adding a form_id to the Admin General Settings form. But, I soon ran into problems. I tried to add the form_id "node-form", but it complained that it was an invalid form id. But, when I inspect the HTML code, that is the actual form ID of the node form. So, why would it complain?

It seems so easy to add Captcha to all other forms, comment forms, e-mail forms, password forms, etc. Why does it seem to be so difficult to add it to one of the most basic forms in Drupal, e.g. the node form?

Maybe I'm just missing something. Please enlighten me.

Comments

soxofaan’s picture

Title: Want to add Captcha to a specific node type » Add CAPTCHA to a specific node type

There is a much easier option for adding a CAPTCHA to a form: enable the "Add CAPTCHA administration links to forms" option on the CAPTCHA administration page, go to the particular "add node" form and open the CAPTCHA fieldset (somewhere at the bottom).

About the form id "node-form" you talk about: I guess you're looking at something like

[form ... id="node-form"]

this is not the Drupal form id (which can not contain hyphens) but the HTML id of a form element (which typically contain hyphens in Drupal).

If you search for "form_id" in the source coude you'll find a hidden form element like

[input type="hidden" name="form_id" id="edit-advpoll-binary-node-form" value="advpoll_binary_node_form"  /]

which reveals the real Drupal form_id: "advpoll_binary_node_form".

hope this helps

jaysadie’s picture

Thank you soxofaan. You've been a great help, and explained it very well. You deserve five stars!

radj’s picture

+100 works great!

Aamuktha’s picture

@soxofaan.Thanks .It worked !

Arjuns’s picture

I followed what soxofaan said
when i am in admin login, it gives option for captcha no challenge enabled on that web form, i did all the changes required and saved.
But when i visit as normal user it doesnt give captcha on form.
Anything else i need to do, please let me know.

wundo’s picture

Issue summary: View changes
Status: Active » Closed (outdated)