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

onClick and Submit Button 1

Status
Not open for further replies.

aarushi2001

Technical User
Joined
Nov 16, 2005
Messages
109
Location
US
Hi guys..

need help... I have a form with 2 options: either a user can 'save and exit' or 'save and continue'.. if I just put <form action"whatever.jsp">.. whatever user clicks he is forwarded to whatever.jsp

If I use onclick=window.href"".. it is not able to extract values entered by user..

what shud I do?
 
You should have two submit buttons, with the same names, but different values. Then simply detect server-side which value was passed to determine which action to perform. Much like the "Preview Post" and "Submit Post" buttons here.

A quick search would have found this, as it's been discussed to death recently.

Hope this helps,
Dan

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Hi.. thanks for such a quick reply.. I did try searching forums before posting (my KWs would have been wrong)..

Dan, so I dont need to use onClick?
 
yup.. I found the link.. thank u so much.. am relatively new.. dont mind my silly question but,

how can I transfer user to next page.. (the code provided alerts based on submit values)
 
Huh? What link?

Transfer to next page? You said you had a form - clicking submit buttons will take the user to the next page if you have an action specified.

Dan



[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
hmm I guess I confused you guys...

I have 2 submit buttons 'save n exit' and 'save n continue'.. on clicking either.. user should be redirected to required page..

 
brilliant Dan.... I have used the method so many times.. but didnt occur I can use it with submit button too :D thank u!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top