Forums

Prevent saving field data in captcha

arvendal 21 Apr, 2010
How do I prevent saving of entered data in the captcha fieled? Visitors that come regularily will get a dropdown list of previous security codes if the have this option activated in their browser. Is there a workaround for this field only? For all browsers, i e both Explorer and Mozilla et al?

Rgds
GreyHead 21 Apr, 2010
Hi arvendal,

The drop-down list is nothing to do with ChronoForms , it's a browser feature (possibly from the Google tool-bar) and you only see your previous entries not anyone else's.

Bob
arvendal 21 Apr, 2010
Yeah I know, but I can't demand from people to shut this browser feature (it's the feature in IE and Firefox that helps people with their passwords etc, it's not a Google feature). What happens is that a list of saved codes will block the captcha image (see attachments).

Ok, I may avoid this by styling the fields to appear in a different way, but I believe there must be a way to deal with this via script or something (I am so useless when it comes to scripts so I can't create one myself). I thought you hade experienced this question before. If you haven't, I think it's something to think about, it can be very annoying for IT-unexperienced visitors (Who still want to save passwords and form data for other websites).

Rgds
GreyHead 21 Apr, 2010
Hi arvendal,

I guess that the simple answer is to move the captcha image so that it isn't hidden. I don't recall seeing it placed below the box; usually it seems to be off to one side.

Bob
arvendal 21 Apr, 2010
I don't want to be a busy body, but the example I sent in the posting above is such an example: the droplist is in fact behind the capcha image. But I will search for another solution.

rgds
GreyHead 21 Apr, 2010
Hi arvendal,

Yes I saw that - hence my suggestion that you get round the problem by moving the image.

Bob
arvendal 21 Apr, 2010
OK. Thanks for your effort. I really like this extension. I will get back to you if I find the solution for preventing the autofill that I am looking for.

Cheers
GreyHead 21 Apr, 2010
Hi arvendal,

Thinking abotu it I guess that it might be possible to do something with some JavaScript. The autofill works of the field name so you could have some script put a random name into the input filed and then write the value from the field into a hidden input with the correct name. I still think moving the image is easier though.

Bob
arvendal 21 Apr, 2010
Well, all I find is the autocomplete = "off" to put into the form or input tags. But it spoils the html validation since it is not a part of the html standard.
nml375 21 Apr, 2010
Hi arvendal,
What about using the domReady event to add the autocomplete property using a javascript? That way the html-code would still validate properly, while any javascript-capable browser (if it supports autocomplete, it almost certainly supports javascripts) would add the autocomplete="off" property as soon as the page completes loading.

I'd try something along these lines:
<?
JHTML::_('behavior.mootools');
$doc =& JFactory::getDocument();
$doc->addScriptDeclaration('window.addEvent("domReady", function() {
  $("image_verification").setProperty("autocomplete", "off");
});');
?>


/Fredrik
arvendal 06 May, 2010
Hi, thanks for the suggestion.
I would like to try it, but I am a bit uncertain where (in what file) to put the suggested code. Can you give me a hint?
Rgds
GreyHead 06 May, 2010
Hi arvendal,

The snippet goes into the Form HTML. I'd add one line just to prevent some possible problems on saving the form:
<?php
if ( !$mainframe->isSite() ) { return; }
JHTML::_('behavior.mootools');
$doc =& JFactory::getDocument();
$doc->addScriptDeclaration('window.addEvent("domReady", function() {
  $("image_verification").setProperty("autocomplete", "off");
});');
?>

Bob
This topic is locked and no more replies can be posted.