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

use type='image' in form, passing 'value'

Status
Not open for further replies.

smandoli9

Programmer
Jun 10, 2002
103
US
My form has two buttons and I want to post which button was pressed. Using the form below, my ASP response can reflect either "1" or "2".

However, instead of type="submit" I'm supposed to be using type="image". When I switch to images, I no longer can capture the 'value' value.


<form name=&quot;form3&quot; method=&quot;post&quot; action=&quot;ResponsePage.asp&quot;>

<input type=&quot;submit&quot; NAME=&quot;Button1&quot; VALUE=&quot;1&quot;>
<br>

<input type=&quot;submit&quot; NAME=&quot;Button2&quot; VALUE=&quot;2&quot;>
<br>
</form>

 
Try this:

<form name=&quot;form3&quot; method=&quot;post&quot; action=&quot;ResponsePage.asp&quot;>
<input type=&quot;hidden&quot; name=&quot;which_one&quot;>
<input type=&quot;image&quot; NAME=&quot;Button1&quot; VALUE=&quot;1&quot; onclick=&quot;document.form3.which_one='1';&quot;><br>
<input type=&quot;image&quot; NAME=&quot;Button2&quot; VALUE=&quot;2&quot; onclick=&quot;document.form3.which_one='1';&quot;><br>
</form>

Rick -----------------------------------------------------------
 
Rick,

Couldn't make that work. My ASP response has

Response.Write Request.Form(&quot;Button1&quot;)
Response.Write &quot;<BR><BR>&quot;

Response.Write Request.Form(&quot;Button2&quot;)
Response.Write &quot;<BR><BR><hr><br>&quot;


And to accomodate your suggestion what I tried adding to those was:


Response.Write Request.Form(&quot;which_one&quot;)
Response.Write &quot;<BR><BR><hr><br>&quot;


Still nothing.
 
I forgot to say that you need to get the value from which_one instead of the button. Try changing which_one to a text box and see if that works. If it does, you can use absolute positioning to do this:

<input type=&quot;text&quot; name=&quot;which_one&quot; style=&quot;position:absolute;left:-400px;&quot;>

Not perfect, but at least it works;-).

Rick -----------------------------------------------------------
 


I changed type to text. But still have not picked up the value. Sigh.

onclick puts me onto some unknown territory -- if it's a key I need to do a little reading.

Aside -- I spent four years in Casablanca for the sake of the Gospel of Christ. Noticed your link there.
 
--So I'm not the only Believer on the forums :-D.

I do PHP, not ASP, so I don't really know, but shouldn't there be some type of ending to those lines? Like a &quot;;&quot;?

Rick -----------------------------------------------------------
 
Rick,

No, VBScript don't need no semi-colon. Wishing to move on to other things, I am going to push back on the client and just use grey buttons. I don't like image buttons anyway.

My hat comes off to you for that web page, which combines awe-inspiring technique, inviting aesthetic, and a most eminently worthy goal.
 
You can make your buttons look different by applying styles:
<input type=&quot;button&quot; style=&quot;border:5px solid red;background-color:blue;color:green;&quot;>
You can apply any style to a button like it was a normal element.

If you are talking about the website, then I thank you very much, because it has been a long and discouraging project without much appreciation.
I made and added the store for a friend who started the A.I.B. group, and instead of acting like it was a free gift, he has seemed to think of it as a paid for service--Why can't you do that??? Why is that like it is??? (!)

IHL,
Rick -----------------------------------------------------------
 
Topic 1: my huge, tremendous ignorance kept me from knowing about formatting buttons. If you saw my work you would not be surprised. Thanks!

Topic 2: I am sorry to hear it's been difficult. I congratulate you on your perseverence. Your acquaintance should be grateful; perhaps the relationship will improve somehow. I once heard there was a real stench inside the Ark, but all within the Ark considered the odor preferable to being in the storm outside. Sometimes we have to think kind of like that just to survive the church, don't we? I'm afraid I'm still kind of traumatized from my stint overseas. But I'd love to know about the site -- how you started it, how traffic is going, whether anyone else is attempting the same thing, and how you have sought to promote it. scott_d_morse @ hotmail if you wish to do this.

-- SM _______________________________
Never confuse movement with action -- E. Hemingway

_______________________________
 
Don't worry...this question is asked here all the time...You should have seen the questions I asked when I joined here...I'm ashamed to quote some of them!

-----------------------

You can create an account there at the message boards and post a thread. I'll answer you there. We could use some real posters, and you could meet some of my great Arab friends--if they ever get around to signing up. Arabs, sadly, have been too generalized since 9-11, and most people have forgotten that there are really good arabs.

Rick -----------------------------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top