Hi,
Firefox doesn't display captcha images properly on validation. In error log we are getting the following message
_node_form post blocked by CAPTCHA module: challenge "Image" (by module "image_captcha"), user answered "", but the solution was "*f$hL".

Whenever there is an error validation in the form - it is a form of node type (say 'page_node_form'), Firefox doesn't render the captcha images properly. It is showing only the 'Image Captcha' as a text. But in case of IE, things are working fine and the same captcha image is rendered.

Let us know how do we resolve the issue in Firefox.

Comments

nagarajanl’s picture

I am not very sure we have communicated the problem clearly.

The Captcha module for Drupal 5 works perfectly. Everytime there is a validation error in Drupal form, the captcha gets refreshed. But in the case of Drupal 6, the Captcha is not getting refreshed.

We tried to address this by calling the captcha function on node validate hook but it did not help. But the form alter captcha function is not accessible form the validate hook. Any help or guidelines to fix this is greatly appreciated.

nagarajanl’s picture

Hi,

Currently we have resolved this issue by clearing the form cache at the time of loading the captcha module. In the hook_init() of captcha module we have added the following code

cache_clear_all('*', 'cache_form', TRUE);

So the form caching will be cleared on every page visit.

The above code will resolve the Firefox captcha issue.

Please let us know is there any better way of resolving this issue.

soxofaan’s picture

Status: Active » Postponed (maintainer needs more info)

Please describe your problem more thoroughly. Your talking about browser differences, differences between drupal5 and drupal6, clearing server side caches, ... It's a bit hard to understand.

describe the form you are adding a CAPTCHA to. Which form? is it a multipage form? is it an AJAX powered form?
Which users get the CAPTCHA?
does the simple Math CAPTCHA work?
what do you mean with "refreshing a CAPTCHA"?

nagarajanl’s picture

Just consider it as a simple form of 'page' type.It will have only 'title', 'description' and we have enabled the captcha for this node type('page'). Let's sya i am trying to submit the form without specifying the 'title' and 'body', the form will not get submitted because i didn't mention the 'title' so that validation error will occur. At this time the 'captcha' image is not rendered properly in firefox. This is the first bug.

But in case of IE 'captcha' image is getting rendered, but for each validation error on the form the same captcha image is generated. Eachtime when a validation error stops, a dynamic 'captcha' images has to be generated. This is the second bug.

Hope i have explained the problem clearly. To get more clarity, please follow the below steps

1) Add the captcha for your in built-in type('page' - say 'page_node_form').
2) submit the form continuously without specifying 'title' and notice the 'captcha' image part. (Both in firefox and IE).

Regards,

Nagarajan.L

Shyamala’s picture

The problem as I see:

The Captcha was not refreshing because of the form cache in Drupal 6. We have temporarily resolved by clearing the cache on every form load. This should not be the ideal way to approach the problem. We must actually refresh only the Captcha element and the rest of the form must be cached. How do we define a dynamic element within a form which doesn't get cached and gets refreshed??

http://shyamala-drupal.blogspot.com/

Leeteq’s picture

Version: 6.x-1.0-rc1 » 6.x-1.0-rc2
Priority: Normal » Critical
rmjiv’s picture

I think we're having this issue. When we have an Image CAPTCHA associated with a node form, when the user submits an invalid answer and the form is redisplayed, the img src value has the value of the previous image, ie. the CAPTCHA isn't regenerated for the form. I'm not sure if this is a node form issue, but I do notice that the form_build_id is the same both before and after submit on node validation errors, unlike other forms.

Any pointers to fixing this would be great.

rmjiv’s picture

After a lot of further investigation, the problem appears to be that the menu module causes a node form to be cached. Consequently, if a user runs into a form validation problem for any reason, the form isn't rebuilt and a new CAPTCHA isn't displayed for the user.

This affects all CAPTCHAs but it is most obvious with an Image CAPTCHA, since the image is broken.

Assuming the solution isn't to just disable the form cache, I'm at a loss as to how best deal with this.

xqi’s picture

I have experienced the problem.

However it works within IE. the image still displays, although it is the same image before user submits the form. as long as user type in the correct code, the form will submit and captcha will pass.

but in firefox, the image will not display if the form fails to pass the validation

--
http://www.bitbridge.com

rmjiv’s picture

For anybody following this, we added:

unset($form['#cache']);

before line 209 of captcha.module

It seems to have solved the problem, but would cause problems if you use the node form to add/remove nodes to the menu.

Sandymaguire’s picture

ok

soxofaan’s picture

at @Sandymaguire in #11: please do not hijack this thread with an unrelated issue, your problem has its own thread: #383346: Image captcha doesn't display the CAPTCHA image, instead displays alt text from corresponding img tag

soxofaan’s picture

Category: bug » support
Priority: Critical » Normal

The CAPTCHA 6.x-1.x branch is officially unmaintained now.
Once CAPTCHA 6.x-2.0 is released, I will close this outdated thread, so please try CAPTCHA 6.x-2.x and report if that fixes the problem.

elachlan’s picture

Issue summary: View changes
Status: Postponed (maintainer needs more info) » Closed (outdated)