Re: FORM element requires ACTION attribute: problems with compatibility

E. Stephen Mack (estephen@emf.net)
Sat, 16 Aug 1997 19:57:30 -0700


Message-Id: <3.0.3.32.19970816195730.00785534@emf.net>
Date: Sat, 16 Aug 1997 19:57:30 -0700
To: www-html@w3.org
From: "E. Stephen Mack" <estephen@emf.net>
In-Reply-To: <19970816.7829B00.F59B@contessa.phone.net>
Subject: Re: FORM element requires ACTION attribute: problems with     compatibility

My thanks to Mike Meyer for explaining that the default
action of a FORM element in HTML 2.0 3.2 is the document's URL.

(This apparently can confuse IE 3 if you're testing locally.)

I stand by most of my original article; I think we see
why the FORM element should now require the ACTION attribute.
Furthermore, it's still difficult for Web authors to construct
scripted documents or elements that use event attributes
that degrade gracefully.

I wrote:
>> If there's no SUBMIT button, it's meaningless to require an ACTION
>> attribute.  (Of course, it's equally meaningless to put the
>> <FORM> and </FORM> tags with no action, but that's what is currently
>> required by existing versions of Navigator in widespread use.)

I see now that both of my statements here are wrong.  The first
statement is doubly wrong, because most browsers will submit
a FORM if there is one TEXT box and the user presses Enter.

I also wrote:

> For example:
> <FORM METHOD="GET" ACTION="noscripting.html">
>   <INPUT TYPE="SUBMIT" VALUE="Foo" ONCLICK="ButtonHandler()">
> </FORM>

My apologies, this only works on IE 3 and Navigator 3; it doesn't
work for IE 4 and Navigator 4.  Here's a solution that works
for all four browsers:

<FORM METHOD="GET" ACTION="noscripting.html" ONSUBMIT="return false;">
  <INPUT TYPE="SUBMIT" VALUE="Foo" ONCLICK="ButtonHandler(this.value)">
</FORM>

If scripting is enabled, your ButtonHandler function will
kick in.  If scripting is disabled, the noscripting.html
document is presented.  (Testing required 8 cases; what a pain.
Yet my testing only is valid for Navigator 3.02, Navigator 4.01,
IE 4.0pp2, IE 3.02 -- and only for Windows 95.)

(Note: IE 3 won't always understand the above if you're using a local
file URL but it works for fully specified URLs or for http:
URLs.)

This is preferable to simply:
<INPUT TYPE="BUTTON" VALUE="Foo" ONCLICK="ButtonHandler(this.value)">
...because:

A) Navigator 3.x and 4.x won't display a button unless it's
   nested in a form element.
B) Non-script-enabled browsers will show a button that does
   absolutely nothing.

Alternately, you could put an explanation in a NOSCRIPT element:

<NOSCRIPT>
The button above won't work.
</NOSCRIPT>
-- 
E. Stephen Mack <estephen@emf.net>    http://www.emf.net/~estephen/