• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

submit button problem in IE

 
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
John Schretz
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 188
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here's an example CSS rule from one of my apps that uses background images for the buttons:


 
John Schretz
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic