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!

Using OnClick event on a Submit Button

Status
Not open for further replies.
Jan 19, 2003
34
US
I'm using ASP/VBScript. I want to put a form value into an ASP Session variable when the submit button on the form is clicked. Is this possible? I thought that the onclick event had to be executed on the client side to work and therefore ASP code that is executed on the server side wouldn't have access to it. Am I even close to being correct?
 
Yea, it wouldn't be possible but you can do something like onclick=formname.sessiondata.value='blah' then have a hidden text field named sessiondata. When you run the form action script, have it evaluate sessiondata and if it's not null, then you have to set your session variable. That's how I'd do it. Almost all of my pages work something like that. I have one ASP file and when the user clicks a button, link or whatever it sets a hidden "mode" value to tell the index.asp what section to run then "submode" as needed, etc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top