?
Solved

IE not passing value of <button> tag properly? (pointer)

Posted on 2005-10-18
4
Medium Priority
?
1,897 Views
Last Modified: 2012-06-27
I'm converting some forms on my site to use the <button> tags instead of <input type="submit"> fields (for skin based CSS styling).  In Firefox and Opera they work just fine, but I found an annoying bug in IE and was wondering if anyone has found a way to get the to work properly.

I make a button tag like:
<button type="submit" name="theButton" value="buttonValue">Button Text</button>

When I click that button and the form submits, the browser is supposed to pass in a parameter named "theButton" with a value of "buttonValue".  With this logic, I can put two different buttons in the same form and let my JSP do different actions based on which button was pressed.  Opera and Firefox do this just fine.  

The problem comes in with Internet Explorer.  Instead of passing in the name/value pair of the button that was pressed, it passes in the "content" of the button tag for each button in the form, regardless of which one was pressed.  In my example above, the parameter named "theButton" would have a value of "Button Text".  If I had a second button called "theOtherButton", it's name/content pair would also be passed in, even if it was not pressed.  This bug makes it so my JSP code can't just check for which button was pressed since all the buttons are being passed in.

There are a couple work arounds that I have thought of:
JavaScript function to set the value of a hidden parameter before submitting the form.
Seperate the forms for each button (real ugly on certain forms, not possible on others).

Any others or perhaps a fix?
0
Comment
Question by:malklavious
  • 2
4 Comments
 
LVL 15

Expert Comment

by:JakobA
ID: 15114151
You can do you CSS styling with <input buttons if you add a bit of javascript.

or you could set the  disable  attribute of the other button to  'disabled'  when the one of the buttons is clicked. that ought to work, even in IE
0
 
LVL 2

Author Comment

by:malklavious
ID: 15119731
So far using JavaScript to set a hidden parameter gives me the most control.  It's just rather annoying that IE is passing the parameter so blantantly wrong.  If there is a non JavaScript way around this issue or maybe some way to code the form in HTML I would prefer that.

Anyone else out there have some input on this?  
0
 
LVL 35

Expert Comment

by:TimYates
ID: 15131573
I can't think of any solution other than that suggested by Jakoba...  switch back to <input class="" for the CSS, or add some javascript :-(

Tim
0
 
LVL 2

Accepted Solution

by:
malklavious earned 750 total points
ID: 15277588
Thanks for the tips everyone, but it doesn't really answer the specific question.  There doesn't seem to be a way to use the <button> tag and have IE behave properly :-(

Going to request this question be closed.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Several part series to implement Internet Explorer 11 Enterprise Mode
This article offers some helpful and general tips for safe browsing and online shopping. It offers simple and manageable procedures that help to ensure the safety of one's personal information and the security of any devices.
Shows how to create a shortcut to site-search Experts Exchange using Google in the Chrome browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch the Search Engine Menu: In chrome, via you…
How to create a custom search shortcut to site-search Experts Exchange using Google in the Firefox browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch your Bookmark Menu: Press 'Ctrl +…
Suggested Courses
Course of the Month15 days, left to enroll

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question