Re: Scripting Techniques first draft

Matt May wrote:

> 
> I have published a first draft of the Scripting Techniques for WCAG 2.0:
> 
> http://www.w3.org/WAI/GL/WCAG20/WD-WCAG20-SCRIPT-TECHS-20040910/

1.1 Example -

1.) I don't like the example much because it is suggesting the 
use of javascript to duplicate functionality that already 
exists. Its the function name (submitmyform) that "proves" this.

2.) I prefer not to always return false on the onsubmit. It is 
the function's job to determine whether it has been successful 
or not, and inform the caller.

I'd much prefer the onsubmit to be:

	onsubmit="return checkFields();"

Removing the "fact" that when using javascript in forms, 
javascript must submit the form - this is such a common mistake. 
And removing the silent failure - the function could fail to 
"submit my form" and the default mechanism is not allowed to react.

1.3 Example - same thing again - using javascript to duplicate 
normal HTML. The biggest problem in this example is that people 
do forget the return false, and then spend days trying to figure 
out why their server is creating duplicates. This then leads to 
further javascript "fixes" to prevent the user pressing submit 
twice - and to no avail.

Also, a server should not rely on the value of the hidden field 
called "clean" - a server should only trust the data it has 
validated.

(I've written up some documentation on validating forms if you 
are interested).

2.1 Javascript URIs - hmm.. didn't know about onactivate - I 
take it that is the device-independant replacement of onclick? 
Is it well supported enough? (I've never used it myself)

2.2 Dynamic content generation - how about using DOM to insert 
new content into another document (with the proviso that there 
is an alternative means of getting the content without requiring 
javascript?) I've done something similar as a javascript Atom 
client.


At the moment I don't see the underlying message of using 
Javascript to enhance a page - I think that is the most 
important concept.


Which reminds me - I've written some material in the past about 
form validation with javascript. I'll get that online at some 
stage and point to it.


Mike.

Received on Monday, 13 September 2004 19:01:26 UTC