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!

different form actions

Status
Not open for further replies.

sthmpsn1

MIS
Sep 26, 2001
456
US
I have a form with the following code.
<form method=&quot;POST&quot; action=&quot;maintain1.asp&quot; onSubmit=&quot;return(showall())&quot;>

if a user clicks one of my buttons I want it to change to this

<form method=&quot;POST&quot; action=&quot;update.asp&quot; name=&quot;Form1&quot; onSubmit=&quot;return(showall())&quot;>

Is there an easy way to do this? I have tried a simple if statement, but can't get it to work right.

 
just make a single page called redirect.asp or you could have it come back to the same page with a querystring
thispage.asp?action=redirect then you could keep all form values etc...

Then do the following:

If request.form(&quot;submit&quot;) = &quot;Button 1&quot; then
Response.Redirect &quot;somewhere.asp&quot;
End if

If request.form(&quot;submit&quot;) = &quot;Button 2&quot; then
Response.Redirect &quot;somewhere.asp&quot;
End if www.vzio.com
ASP WEB DEVELOPMENT



 
if you do a redirect like this

If request.form(&quot;submit&quot;) = &quot;Button 1&quot; then
Response.Redirect &quot;somewhere.asp&quot;
End if

If request.form(&quot;submit&quot;) = &quot;Button 2&quot; then
Response.Redirect &quot;somewhere.asp&quot;
End if

it looses the values in the form.
 
see my page reloads two times before the button that I want to redirect to a different page shows up.
 
You can use Javascript also. On the click event of the button that you want to submit to a different page, call a function like this:


function btnChangeLoc_onClick(){
document.theForm.action = &quot;newUrlHere&quot;;
document.theForm.submit();

}
 
if you submit using the javascript command how do you pass the values to the next page. Mine isn't submiting the values.
 
strElement = Request.form(&quot;element_name&quot;)

should give you the values from the form because the form is actually submitting to the next page.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top