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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Howto handle one form with multiple submit buttons (image buttons) 2

Status
Not open for further replies.

Gert74

Technical User
Jan 26, 2001
48
0
0
NL
Hello,

My problem is the following:
I have a form which looks something like this:

Url1-[Textbox with description] [Downimage-button][del-button]
Url2-[Textbox with description] [Downimage-button][del-button]
Url3-[Textbox with description] [Downimage-button][del-button]
..
Url9-[Textbox with description] [Downimage-button][del-button]
[submit-button]

With this form a user is able to:
- Change the description (textbox followed by [Enter] or [submit-button]
- Change the order with the [down-image button]
- Delete a row wit [del-button]

If a user changes the text of a link and follows this action with the [down-image-button], the text should be changed AND the order should be changed.

Now we have come to my problem: how do I know which (image)-button is pressed so I can handle my form in the right way/order. Javascript is not allowed here.

I hope this makes sense, if not, let me know!

Gert

Gert
 
Tony,

This solution seems to work for normal buttons (<input type="submit " name="uniquename" value="Submit" />) but doesn't work for image-buttons (e.g. <input name="anotheruniquename"type="image" id="anotheruniquename" src="picture.gif" />. Unfortunately I have to use those images.

I used both buttons on a form and tried this code:
Code:
if request.form("uniquename") <> "" then
  response.write("Normal button")
elsif request.form("anotheruniquename") <> "" then
  response.write("Image button")
else
 response.write("something else happened")
end if

Pressing the image_button always returns "something else happened" while the normal button returns the right value (i.e. "Normal Button").

Gert
 
This isn't the solution to my problem (I think). The form submits perfectly without the value="submit", but I cannot get the name of the image-button pressed.

This didn't change when I added value="submit" to my imagebuttons

Gert
 
Beat me to it tsuji!


Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Thanks tsdragon, we all learn the stuff from more or less the same source! - tsuji
 
Finally got the solution!!!

Code:
 if request.form("image_button.x") <> "" then
   response.write "image_button pressed"

Thanks tsuji!!!

Gert
 
Not for nothing, but why no javascript?

(I know, I know, security...FUD).

I don't even know if I could code ASP without javascript anymore! ;-)

TJR
 
Because we want our site to be as accessible as possible. Think of handicapped people, pda's and smartphones. If possible we'd like to avoid Javascript.

Gert
 
If it is accessibility you may want to start coding in ASP.NET...my understanding it is has the best platform/browser independence.

As for small form factor, I have had to develop some sites to support HTML browsers and WAP phones....and it required two sets of pages. I understand with .NET you don't need to do that dual development.

I am glad I asked.

TJR
 
I agree with you that ASP.Net offers more possibilities, but in this specific case I'm hired by this customer to make a site on their existing platform (in combination with Tridion CMS), which happens to be ASP. Interesting point about dual development in ASP.Net though, something to investigate.


Gert
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top