Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Image submit button 1

Status
Not open for further replies.

stefanica

Programmer
Aug 11, 2003
4
RO
Hi,

I have to change in an application all submit buttons with image buttons.
The problem is that the image button don't send the value parameter but the x and y coordinates. The application uses the behaviour of the submit button who sends in request a parameter with name the name of the submit object and value the value of the button because there are more then one submit button in the forms for differend actions.
Can somebody tell me how to replace the buttons with images and keep the functionalty (send a parameter with a secified value..)?


Thanks
Stefan
 
use hidden fields. have a hidden field called type:
<input type=&quot;hidden&quot;>

when the user clicks image 1 then using JS change the hidden field value to lets say 1. now submit the form. read the hidden field value in ur backend and do accordingly...

i hope u understand me...

Known is handfull, Unknown is worldfull
 
This was my ideea too.
I wanted to know if there is another solution (less complicate because the forms are automaticaly generated by struts...). Thank anyway.
 
I don't think you can get image buttons to send a name=value pair the same as a submit button. Hidden inputs won't help you, as they'll always get sent regardless of which button gets pressed.

What you'll have to do (I think) is change your scripts. You used to have a button like this:
[tt]
<input type=&quot;submit&quot; name=&quot;save&quot;>
[/tt]
and test for the existence of a parameter called &quot;save&quot; to see if it was pressed. Now if you want to change it to
[tt]
<input type=&quot;image&quot; src=&quot;save.gif&quot; name=&quot;save&quot;>
[/tt]
you can't test the &quot;save&quot; parameter any more, but you can test &quot;save.x&quot; (or &quot;save.y&quot;) parameters instead. Those parameters will only have a value if that button was pressed. (I can't offer more specific advice without knowing what your scripting language is).

-- Chris Hunt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top