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".

I recieved a warning "Illegal form_id" on the "CAPTCHA point adminstration" page.

Comments

traxer’s picture

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

traxer’s picture

Version: 6.x-1.0-rc1 » 6.x-2.x-dev
soxofaan’s picture

Version: 6.x-2.x-dev » 6.x-1.x-dev
Assigned: Unassigned » soxofaan
Status: Active » Patch (to be ported)

Good catch
fixed in HEAD by http://drupal.org/cvs?commit=108203
This commit also includes the first SimpleTest tests for CAPTCHA module, yay!
(Tests cover the CAPTCHA point administration)

soxofaan’s picture

Status: Patch (to be ported) » Fixed

fixed for 6.x-1.x by http://drupal.org/cvs?commit=108204

(issue not applicable to 5.x-3.x, but it is applicable to issue/patch http://drupal.org/node/214557#comment-777792)

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

Todd Nienkerk’s picture

Is there any chance of this fix being backported to 5.x? I'm experiencing the same problem in 5.x-3.2.

Todd Nienkerk’s picture

Scratch that. User error!

webengr’s picture

Status: Closed (fixed) » Active

I am using drupal 6.12
with webform 6.x-2.6 2009-Feb-16
with captcha
captcha-6.x-2.0-beta5.tar.gz

oops using beta..

and I looked and the form id generated by webform module is "webform-client-form-7"

note it is using hyphens, -, and not underscores, _

I get the illegal notice with that form ID.

I was able to enter it into the captcha page with underscores, without the illegal notice,
but it is using hyphens so that does not help.

I Just updated to the dev capatcha from May 18 - it also fails, Illegal form_id

webengr’s picture

hmmm,

in the file captcha/captcha.admin.inc

I added a hypen after the pregmatch for a-z0-9_

Will see what it does...

 if (!preg_match('/^[a-z0-9_-]*$/', $form_id)) {
webengr’s picture

Status: Active » Closed (fixed)

Alright, crazy webrower inspect element showed id with hyphens...
getting confused, after updates the form id is showing with undescores not hyphens...

so disregard.

apologies.

soxofaan’s picture

@webengr: The internal form id in Drupal is always with underscores,
when rendered in HTML, the underscores are replaced with hyphens in some places like in the <form ...> element, but there should also be an hidden element like
<input type="hidden" name="form_id" id="edit-comment-form" value="comment_form" />
which shows the real form id (comment_form in this case)

dyland’s picture

It was rejecting my form id due to camel casing - I fixed by adding ignore case to preg_match i.e.
if (!preg_match('/^[a-z0-9_-]*$/i', $form_id)) {

soxofaan’s picture

How do you get a camel cased form_id? A standard Drupal form_id is [a-z0-9_] only. Is it a custom module?

Ian Burge’s picture

Drupal forms use underscores, replace the hyphens with underscores and it should work.

yuganathan2020’s picture

Issue summary: View changes

I have faced same illegal error i have fixed using the form id webform_client_form_ using underscore if we use hypen its through the error.