Welcome to WebmasterWorld Guest from 54.234.38.8

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)

Junior Member

10+ Year Member

joined:Jan 11, 2003
posts:71
votes: 0


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..

rpe259

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

Inactive Member
Account Expired

 
 


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)

Senior Member

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

joined:May 26, 2000
posts:37301
votes: 0


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)

Senior Member

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

joined:Nov 28, 2004
posts:7999
votes: 0


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)

Senior Member

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

joined:Mar 2, 2003
posts:3710
votes: 0


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.

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members