Skip to main content

Illegal form_id error after entering form ID in captcha module in Drupal7



Form ID of the form is "webform_client_form_21". CAPTCHA module validates Form IDs using /^[a-z_]+$/.

then  Goto sites\all\modules\captcha
and Open captcha.admin.ini file
add modify line no 255,400 line 


preg_match('/^[a-z0-9_]+$/', to preg_match('/^[a-z0-9_-]+$/', and save file.



  1. Created a form with the webform module,
  2. checked "Add CAPTCHA administration links to forms",
  3. visited a form I created with the Webform module,
  4. clicked the link "Place a CAPTCHA here for untrusted users."
  5. clicked "Save". now you are done


but to work captcha just modify form id for exaple if you got form id from webform 
webform-client-form-1 then enter form id to captcha webform_client_form_1 :)

Comments