Welcome to WebmasterWorld Guest from 23.23.62.93

Forum Moderators: open

Message Too Old, No Replies

Button tag does not send it's form variable in IE

using For button tag, variable is not passed in IE, but in Opera?

   
2:59 pm on Jan 24, 2005 (gmt 0)

10+ Year Member



Migrating my forms from the
<input type=button>

to the

<button name=varName value=varValue>ButtonText</button>

IE does NOT pass the variable "VarName" if clicking on this button. Opera does it without problems.. (using PHP for Post processing)

If there is a single button on the page, no problem I just add a hidden field with the value, but if there are multiple buttons, and I would like to define the action to take via buttons, HowTo?

Anybody else experienced the same? What I'm missing? Can't find anything explaining this behaviour..

3:44 pm on Feb 20, 2005 (gmt 0)

10+ Year Member



There seems to be a general problem with this one:

<button name='f1' value='1'>Garbage</button>

In Firefox, the POST variable is f1=>1 -- exactly what I would expect, but in IE6, it is f1=>Garbage

Just explain, I am using <button> in order to modify post-processing defendant on the button pressed. Firefox only receives the button name which was pressed (e.g., name='f1' and name='f2' -- press button 'f2' and 'f1' does not appear in the POST list. In IE, both appear, and with the following text as a value.

Does anybody have any idea how to get around this, or is it a feature?

7:32 pm on Feb 20, 2005 (gmt 0)

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Here's what Microsoft says for IE5+:

When the BUTTON element is submitted in a form, the innerText value is submitted.
MSDN Reference [msdn.microsoft.com]

IE's behavior here is non-standard. Apparently, this is a feature.

4:26 pm on Feb 21, 2005 (gmt 0)

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Is there something wrong with input type=button? (So much to keep up with, sorry if this is obvious.)
5:39 pm on Feb 21, 2005 (gmt 0)

WebmasterWorld Senior Member kaled is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Set name="" and adjust the form processor to ignore fields with a blank name.

So far as I am aware, that is the only way to fix the problem across all browsers.

Kaled.