Results 1 to 10 of 10
input type= image vs. submit Forum: HTML ForumReplies: 5
Having trouble adding top image over background image Forum: Myspace ForumReplies: 3
onSubmit sends email of form data Forum: HTML ForumReplies: 2
Need Help! Image from another source displays if first image errors... Forum: HTML ForumReplies: 14
How do I swap an image for BOTH an image and a sound? Forum: Website Scripts ForumReplies: 1
11-06-2002, 08:45 AM #1
Submit with Image tag that sends its own value
On monday we had to code a form for a shop system. You can take goods in a shopping cart, and we wanted the customers to be able to delete single goods from it. No Problem with the boring gray Submit-Button, but how to make with an input type image? ALl i have to know is, if theres any possibility of senden an input type=images´value?
The necessity results from the structure of the shopping cart. You have a row for each good, and even a delbutton for each good.
So if i could request the value, i knew which good must be deleted.
I hope someone understands me.
11-06-2002, 10:58 AM #2
Hi there. Welcome to the forums.
If you give the input a name, it will be picked up as a POST variable in the form. so -
<input type="image" src="sflogo.jpg" name="SUBMITBUTTON" value="Hello">
On a related note, not a lot of people know that if you use an image submit in this way, it also transmits the X and Y coordinates of the image, ie - where the user clicked the image. QUite handy.
The POST array for above looked like this -
Array ( [SUBMITBUTTON_x] => 12 [SUBMITBUTTON_y] => 9 [SUBMITBUTTON] => Hello )
Hope that helps.
11-07-2002, 06:42 AM #3
Nice try, but it doesnt work...
I really dont know why? I built a testsite on http://www.mkunz-asp.de/image/send.htm
which only send an input type=image to the "get.asp". After request.form there is nothing in my variable. Maybe if you see my code, you can tell me what im doing wrong.
11-07-2002, 07:23 AM #4
Seems to be working.
Obviously, I do not see your asp code, but it seems to be writing 'Hello' (the value of the button) and then 'leer' the value of the text box.
So I guess you got it! Unless I misunderstood the problem.
11-07-2002, 07:38 AM #5
Thats really disgusting. I cant see the text "hello" when i call the page...
Maybe it depends on the used browser?
Im using ie6, should work?
we now are very confused about it.
have you some working code on the net?
So please show me...
addon: oh yes i see. in netscape it is shown, in ie not. so really THX
addon2: if there is any idea, why IE doesnt like the formheader, please post...
Last edited by gohatesusall; 11-07-2002 at 08:24 AM.
11-07-2002, 08:30 AM #6
I see what you mean, my IE does the same (I use Mozilla by default).
I would guess there is something wrong with your get.asp script.
Try simplifying it -
<% response.write(request.form("text") & " " & request.form("SUBMITBUTTON") & "<br />") %>
Anyway, try a file with just the above in, see what happens.
11-07-2002, 11:11 AM #7
Don't even bother.
Microsoft deliberately ignore any value in this type of submit. They send the x and y coords (these, but no value!) but ignores value.
The specs are outlined here -
Even if you use a different scripting language, Internet Explorer is not sending the information in the first place, so there isn't much you can do. Sorry.
11-07-2002, 11:26 AM #8
I just read up on the DOM specs for the element too, html4.0.
It doesn't mention of value to be passed, but it does imply it. grr.
If interested, its here
11-07-2002, 01:56 PM #9
Thats really disappointing. So we have to develope another solution. But THXALOT!! I had to mention that a long time before posting... (-; THXALOT!!
Last edited by gohatesusall; 11-08-2002 at 03:34 AM.
11-11-2002, 12:03 AM #10
i suggest that u do this:
have 1 submit button, and each row have a checkbox. when displaying each row (i'm assuming you're using a productid or have some way of identifying each product),
response.write "<tr><td><checkbox name='pdt1' value='" & ProductID & "'></td>"
response.write "<img src='url.jpg' onClick='addproduct();'>"
(between <head> and </head>)
this way, u can tell which product was chosen
use a different page to process add,delete etc
compartmentalizing makes it easier to debug
hope this helps