W3C home > Mailing lists > Public > w3c-wai-gl@w3.org > July to September 1999

Re: Script replacement ?

From: Chris Kreussling <CHRIS.KREUSSLING@ny.frb.org>
Date: Tue, 21 Sep 1999 10:29:48 -0400
To: w3c-wai-gl@w3.org
Message-id: <s7e75e7d.078@ny.frb.org>
>>> <w3c-wai-gl@w3.org> 09/21 2:53 AM >>>

What's the best way of replacing/completing a javascript that fetches
a new page using an onchange event on a FORM SELECT ?

This is usually done on a page to cut on the number of "activate" the
user has to go thru: one instead of two.

<FORM name="f1">
<SELECT name="s1" 
        onchange="window.location =
                    document.f1.s1.options [
<OPTION VALUE="http://www.site.com">Go to Site1</OPTION>
<OPTION VALUE="http://www.joe.com">Go to Joe</OPTION>

As you can see, no submit button, no FORM action.
(invalid HTML among other things)

For non-script aware agents, one would have to add a submit button
next to the SELECT, an action to the FORM, and have a server
script/cgi at the other end of the action handling the redirect to the
new page.

My question: is it better to have this server program (CGI or else)
use HTML redirect, that is, return a simple HTML document with

 <META http-equiv="refresh" content="0,http://www.site.com">

or operate directly at the HTTP level by returning a "303 See Other"
HTTP reply ?

1) Correct the invalid HTML and add ACTION="..." to <FORM>. <http://www.w3.org/TR/REC-html40/interact/forms.html#edef-FORM> Specify your CGI or other server-side script/code as the target of the action. Without valid HTML, accessibility is difficult and limited, at best.

2) Correct the inaccessible form and add <INPUT TYPE="SUBMIT" ...> to the form. Accessibility requires that a non-script option is available. This can be placed within <NOSCRIPT> </NOSCRIPT> to hide it in case the user has scripting available.

3) From your CGI or other server-side script/code, generate the true HTTP redirect, Response Code 303. <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.4> Don't use the META REFRESH hack.

<author>Chris Kreussling</author>
<disclaimer>The views expressed are 
those of the author and do not necessarily 
reflect the position of the Federal Reserve 
Bank of New York or the Federal Reserve 
Received on Tuesday, 21 September 1999 10:33:31 UTC

This archive was generated by hypermail 2.4.0 : Thursday, 24 March 2022 21:07:16 UTC