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!

Cannot use Request.Form in VBScript function??

Status
Not open for further replies.

briancostea

Programmer
Apr 21, 2005
82
US
Does any one know why I cannot use Request.Form in a SBScript function? I am trying to set a session variable.

<input type="button" class="goButt" value="GO" onClick="DoStart()"></input>

<script language=VBScript>
<!--
function DoStart()
<%session("sub") = Request.Form("lstExperts")%>
parent.right.location.HREF="showExp.asp"
end function
//-->
</script>

this redirects the page, but the session variable is not set.
 
Are you perhaps confusing server side code with client side code?

This linee: <%session("sub") = Request.Form("lstExperts")%>

It will execute when the page is rendered and sent to the client.... not when the button is clicked.
 
thanks much. do you know if there is a way to set a session variable and redirect when the user clicks a button?
 
You can set a session variable only when the ASP is actually running.

That means you can only set it while the page is being created.

If you want it to have a value from a submitted form then the place to put it is not on the page with the form, because the ASP will have all already run by the time the user fills in the form.

Instead the place to set the session variable is on the page that processes the form... in other words the page specified by the action property of your <form> tag.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top