Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Persuading IE to do the right think with <BUTTON>

0 views
Skip to first unread message

Steve Swift

unread,
Dec 9, 2007, 1:30:01 AM12/9/07
to
Faced with:
<BUTTON NAME=ORDER VALUE=1 TYPE=SUBMIT>Order</BUTTON>
Internet explorer sends "ORDER=Order" rather than "ORDER=1".

Is there any way to persuade it to do what was intended, to submit the
actual VALUE of the button rather than its caption?

Is there any HTML proposal to add add an extra parameter to the <SUBMIT>
control (something like USEVALUE) so that IE would have to implement it
properly, and we could write sensible CGI scripts?

--
Steve Swift
http://www.swiftys.org.uk/swifty.html
http://www.ringers.org.uk

Adrienne Boswell

unread,
Dec 9, 2007, 4:48:33 AM12/9/07
to
Gazing into my crystal ball I observed Steve Swift
<Steve....@gmail.com> writing in news:475c...@news.greennet.net:

> Faced with:
><BUTTON NAME=ORDER VALUE=1 TYPE=SUBMIT>Order</BUTTON>
> Internet explorer sends "ORDER=Order" rather than "ORDER=1".
>
> Is there any way to persuade it to do what was intended, to submit the
> actual VALUE of the button rather than its caption?
>
> Is there any HTML proposal to add add an extra parameter to the
<SUBMIT>
> control (something like USEVALUE) so that IE would have to implement
it
> properly, and we could write sensible CGI scripts?
>

It's a known bug in IE. The only thing you could do is use javascript,
but then you could still have a user with js turned off submit an
incorrect value.

You could assign a name attribute to input type="submit", eg: <input
type="submit" name="1" value="Submit"> or you could put the value in a
type="hidden" input element.

--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share

Adrienne Boswell

unread,
Dec 9, 2007, 4:59:16 AM12/9/07
to
Gazing into my crystal ball I observed Adrienne Boswell
<arb...@yahoo.com> writing in news:Xns9A011266A34ABarbpenyahoocom@
69.28.186.121:

> Gazing into my crystal ball I observed Steve Swift
><Steve....@gmail.com> writing in news:475c...@news.greennet.net:
>
>> Faced with:
>><BUTTON NAME=ORDER VALUE=1 TYPE=SUBMIT>Order</BUTTON>
>> Internet explorer sends "ORDER=Order" rather than "ORDER=1".
>>
>> Is there any way to persuade it to do what was intended, to submit
the
>> actual VALUE of the button rather than its caption?
>>
>> Is there any HTML proposal to add add an extra parameter to the
><SUBMIT>
>> control (something like USEVALUE) so that IE would have to implement
> it
>> properly, and we could write sensible CGI scripts?
>>
>
> It's a known bug in IE. The only thing you could do is use
javascript,
> but then you could still have a user with js turned off submit an
> incorrect value.
>
> You could assign a name attribute to input type="submit", eg: <input
> type="submit" name="1" value="Submit"> or you could put the value in a
> type="hidden" input element.
>

In addition:
http://msdn2.microsoft.com/en-us/library/ms535211.aspx and

Jonathan N. Little

unread,
Dec 9, 2007, 9:44:30 AM12/9/07
to
Steve Swift wrote:
> Faced with:
> <BUTTON NAME=ORDER VALUE=1 TYPE=SUBMIT>Order</BUTTON>
> Internet explorer sends "ORDER=Order" rather than "ORDER=1".
>
> Is there any way to persuade it to do what was intended, to submit the
> actual VALUE of the button rather than its caption?
>
> Is there any HTML proposal to add add an extra parameter to the <SUBMIT>
> control (something like USEVALUE) so that IE would have to implement it
> properly, and we could write sensible CGI scripts?
>

<input name="order" type="submit" value="Order">

Perl:

$order=param('order') eq 'Order' ? 1 : 0;

What makes you hope that MS will "come on board" any time soon?

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com

VK

unread,
Dec 9, 2007, 12:51:02 PM12/9/07
to
On Dec 9, 12:48 pm, Adrienne Boswell <arb...@yahoo.com> wrote:
> It's a known bug in IE.

From MSDN:
"Specifies a container for rich HTML that is rendered as a button. ...
When the BUTTON element is submitted in a form, the innerText value is
submitted"

So not a bug but intentionally programmed behavior: reminds the event
model for Java 1.x buttons - maybe it was made this way to make the
integration seamless (that was the time of the short "big Microsoft+Sun
+Java" companionship"). I do not expect it being fixed until the last
compatibility insurance expired for corporate customers, so at least
until the year 2015.

See also: http://msdn2.microsoft.com/en-us/library/ms535211.aspx

Jonathan N. Little

unread,
Dec 9, 2007, 2:00:53 PM12/9/07
to

Unfortunately other browsers follow W3's recommendation

www.w3.org/TR/html4/interact/forms.html#edef-BUTTON

"<!ELEMENT BUTTON - -
(%flow;)* -(A|%formctrl;|FORM|FIELDSET)
-- push button -->
<!ATTLIST BUTTON
%attrs; -- %coreattrs, %i18n, %events --
name CDATA #IMPLIED
value CDATA #IMPLIED -- sent to server when submitted
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

and send the value parameter to the server and not the innerText. MS's
"different drummer" attitude can be a PITA in many areas...

Steve Swift

unread,
Dec 9, 2007, 2:10:18 PM12/9/07
to
Adrienne Boswell wrote:
> http://msdn2.microsoft.com/en-us/library/ms535211.aspx and

Wow! They even have the gall to document that it works incorrectly.

My form has a couple of INPUT TYPE=TEXT fields and several INPUT
TYPE=SUBMIT buttons, so I need both the name and the value to make sense
of which button the user pressed. In most cases I can encode both the
name and the value in just the name, as in NAME="DELETE.document_1.txt"
and that gives me a consistent interface for my CGI scripts across
browsers. It's a little cumbersome though.

Thanks for the information.

Jukka K. Korpela

unread,
Dec 9, 2007, 2:55:24 PM12/9/07
to
Scripsit Steve Swift:

> Faced with:
> <BUTTON NAME=ORDER VALUE=1 TYPE=SUBMIT>Order</BUTTON>
> Internet explorer sends "ORDER=Order" rather than "ORDER=1".

And it gets even weirder if the <button> element's content has some
markup. Who would have guessed that the content with all the markup gets
sent?

> Is there any way to persuade it to do what was intended, to submit the
> actual VALUE of the button rather than its caption?

Not really. Of course you could upgrade the construct to a nice normal
submit button
<input type="submit" name="ORDER" value="1">
but even this isn't really safe, really. Sorry. Please don't shoot the
messenger.

> Is there any HTML proposal to add add an extra parameter to the
> <SUBMIT> control (something like USEVALUE) so that IE would have to
> implement it properly, and we could write sensible CGI scripts?

They decided to break the rules seriously when implementing <button> in
IE, so why would they care about new rules any more?

The reason why even
<input type="submit" name="ORDER" value="1">
isn't really safe is that in most cases, you have at least one text
input field in the form. Now, what happens when the user hits Enter in
that field? The specifications are unclear. Common browser behavior
seems to be that the form data is submitted as if the _first_ submit
button were used, but would you really rely on this?

The safe approach is to have a single submit button (or several submit
buttons with the same function, for convenience, in some cases). This
means that you would use radio buttons or checkboxes to select the
action to be carried out. Granted, this means that often the user needs
to click twice (radio button and submit button) instead of clicking
once, but on balance, the single click takes more time since the user
has to select between alternatives.

(If you use radio buttons that way, make sure one of them is
preselected, with checked="checked", normally a neutral one indicating
no action. This is an additional measure against unintended actions.)

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Steve Swift

unread,
Dec 10, 2007, 1:44:16 AM12/10/07
to

Several hours later I got to pondering: I wonder if any one at all finds
the inner html useful when returned where the VALUE= should be expected?

Even amongst web developers at Microsoft.

Jonathan N. Little

unread,
Dec 10, 2007, 9:32:53 AM12/10/07
to
Steve Swift wrote:
>> In addition:
>> http://msdn2.microsoft.com/en-us/library/ms535211.aspx and
>
> Several hours later I got to pondering: I wonder if any one at all finds
> the inner html useful when returned where the VALUE= should be expected?
>
> Even amongst web developers at Microsoft.
>

I cannot see any use, considering having to use VALUE attribute in order
to change the caption of <INPUT TYPE='submit'> is normally undesirable.

Ask them. I can only imagine the response.

Bergamot

unread,
Dec 10, 2007, 12:31:43 PM12/10/07
to
Steve Swift wrote:
>>
>> http://msdn2.microsoft.com/en-us/library/ms535211.aspx

>
> Several hours later I got to pondering: I wonder if any one at all finds
> the inner html useful when returned where the VALUE= should be expected?

innerHTML is a Microsoft invention thus a non-standard attribute, so I'd
say not. Other browsers do support it (out of necessity, I imagine), but
avoid it if there is a standards way to get the info.

--
Berg

Steve Swift

unread,
Dec 11, 2007, 2:07:01 AM12/11/07
to
Bergamot wrote:
> innerHTML is a Microsoft invention thus a non-standard attribute, so I'd
> say not.

InnerHTML is a concept that I've managed without so far. In the context
of <BUTTON>, I just assumed that it was the "stuff" between the <BUTTON>
and the </BUTTON>, since that is what I get in my CGI scripts.

0 new messages