wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes submit button problem in IE Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "submit button problem in IE" Watch "submit button problem in IE" New topic
Author

submit button problem in IE

John Schretz
Ranch Hand

Joined: Sep 10, 2008
Posts: 188

I have 2 butttons on a form. 1 submits the order and the other submits calculate Shipping
WHen i log the results on the server side no matter which button i press they are null

This same code works fine in the latest firefox

am i missing something?

TIA John


Form code


Server Code
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30537
    
150

John,
I've never seen a value attribute on an image/submit button before. Have you tried using a hidden field to send the value to the server and just use the image tag for the actual submit?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
John Schretz
Ranch Hand

Joined: Sep 10, 2008
Posts: 188
but then how would i know which button was pressed? I am using an image instead of the generic looking button.
As far as I know thats the only way to do it
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Jeanne Boyarsky wrote:John,
I've never seen a value attribute on an image/submit button before.

The name/value pair of an input type="image" or input type="submit" or button type="submit" element can be used at the server side to distinguish the button pressed. Useful if you've multiple submit buttons in one form. Filling a hidden field and manipulating it with JS is just cumbersome.

Back to actual problem: IE has the behaviour that in case of an input type="image" it will append the name with ".x" and ".y" to represent the position of the mouse cursor at the image.

You can solve it by either using CSS background property to picture a button instead, or to not only check for parameter "name", but also "name.x" if a specific button is pressed.
John Schretz
Ranch Hand

Joined: Sep 10, 2008
Posts: 188
Bauke Scholtz wrote:
Jeanne Boyarsky wrote:John,
I've never seen a value attribute on an image/submit button before.

The name/value pair of an input type="image" or input type="submit" or button type="submit" element can be used at the server side to distinguish the button pressed. Useful if you've multiple submit buttons in one form. Filling a hidden field and manipulating it with JS is just cumbersome.

Back to actual problem: IE has the behaviour that in case of an input type="image" it will append the name with ".x" and ".y" to represent the position of the mouse cursor at the image.

You can solve it by either using CSS background property to picture a button instead, or to not only check for parameter "name", but also "name.x" if a specific button is pressed.


so if i use the css for the BG image how would i make the actual submit button transparent?

thanks for the help
john
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61224
    
  66

Here's an example CSS rule from one of my apps that uses background images for the buttons:



[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
John Schretz
Ranch Hand

Joined: Sep 10, 2008
Posts: 188
ok, so i tried the .x on the parameter name in my servelt and that seemed to work. i did this as it was the quickest solution.
One thing to note is the name doesnt seem to matter on the server side. it just comes back as a number and the button that was not pressed is just null.
So the only limitation i see is that you cant compare names. Its either null or not null. so i guess in the case of having more than 2 buttons to compare this would not work and the best bet would be using the background image.
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
John Schretz wrote:ok, so i tried the .x on the parameter name in my servelt and that seemed to work. i did this as it was the quickest solution.
One thing to note is the name doesnt seem to matter on the server side. it just comes back as a number and the button that was not pressed is just null.
The CSS solution is preferred.


So the only limitation i see is that you cant compare names. Its either null or not null. so i guess in the case of having more than 2 buttons to compare this would not work and the best bet would be using the background image.
I don't see why you can't use more than 2 buttons. To check if a certain button is pressed, just check if its name/value pair is present in the request parameter map. If you use image buttons only and assign them all the same name, then it isn't going to work in IE. But if you use normal submit buttons, then you can assign them all the same name and a different value and in the server side you could check by only the name which button is pressed.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: submit button problem in IE