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

two button form case prob... 1

Status
Not open for further replies.

mjonson

Technical User
Mar 9, 2004
128
GB
thought i had this sorted but was not doing what i thought..

have twobuttons

Code:
<form action = "dealaddmain.asp" method = "post">
<input name="action" type="image" src="images/calcbut1_01.gif" width="108" height="50" border="0" value = "X"><input name="action" type="image" src="images/tbot14_02.gif" width="75" height="50" border="0" value = "A">
</form>

then i have the select case at the top of page

Code:
<% pagestate = Request.form("action")
Select Case pagestate
Case "X":
response.write "X"
Case "A":
response.write "A"
end select %>

the page refreshed but the values are not displayed
ne ideas welcome
 
The image input doesn't return a normal value like other inputs - it returns the x/y coordinates of where the image was clicked.

Add a hidden form field and write a little javascript function, that is called when you click the images, that sets the value of the hidden input and then submits the form.

--James
 
can you give me an example or should i post this in java forum?
 
Something like this:

Code:
<form action="test.asp" method="post">
<input type="text" name="txt1" />
<input type="hidden" name="hdnAction" value="" />
<input type="image" src="images/calcbut1_01.gif" onclick="this.form.hdnAction.value='X';" />
<input type="image" src="images/tbot14_02.gif" onclick="this.form.hdnAction.value='A';" />
</form>

Then read the value of Request.Form("hdnAction") on your target page.

--James
 
ok have it sorted
thanks for the pointers jameslean but have done it without using java
Code:
<input name="action" type="image" src="images/calcbut1_01.gif" width="108" height="50" border="0" value = <% pagestate = "X" %>><input name="action" type="image" src="images/tbot14_02.gif" width="75" height="50" border="0" value = <% pagestate = "A"%>>

<input name="pagest" type="hidden" value="<%= Server.HTMLEncode(pagestate&"") %>" size="6" maxlength="6">

then request.form("pagest")
and make the case
 
after trying to make this page using my idea above
it doesnt work
James Lean' idea DOES so try that(thanks again)

however how do you get the the page to return to the same state it was when the button is clicked?
i mean where the vertical slider is when the page is submitted

it would be ok if the page was refreshed at the bottom as this is where people are clicking the button
 
put this where you want page to stop
<a name="pagestop"></a>

after your link put
#pagestop
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top