On 27/07/2004, at 11:08 AM, Peter Asquith wrote:

Hi all

I'm in the process of validating the markup in a suite of on-line
assessment tools, which includes an ability measure. As you can imagine,
in situations where those being assessed share the same computer, it's
not acceptable for IE users with AutoComplete enabled to have the
previous candidate's answers defaulted!


The autocomplete attribute is not part of the XHTML 1.0 Transitional DTD
and therefore any <input> tags containing autocomplete="off" will not
validate.


The best I can think of is to sniff for IE (much as I'm loathe to revert
to last century's techniques) and insert the attribute on a case by case
basis. Does anybody know if there are workarounds for this or is this
just one of those things?

DOM scripting could dynamically add the attribute, which is 100% compliant. Something like:


function autoCompleteOff() {
        if (!document.getElementsByTagName) return;
        var inputs = document.getElementsByTagName("input");
        for (var i=0; i<inputs.length; i++) {
                var input = inputs[i];
                if (input.getAttribute("type") == "text") {
                        input.autocomplete = "off";
                }
        }
}
window.onload = autoCompleteOff;


This of course won't help for IE with JS off, and you're not tackling any other browser with autocomplete (Safari, Mozilla, Firefox???), but it's a start.


---
Justin French
http://indent.com.au

*****************************************************
The discussion list for http://webstandardsgroup.org/
See http://webstandardsgroup.org/mail/guidelines.cfm
for some hints on posting to the list & getting help
*****************************************************




Reply via email to