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

Hidden field variables 1

Status
Not open for further replies.

johnaregan

Programmer
Mar 13, 2001
87
Hi
I have a page which uses Request.Form to get a variable from a previous page. Is there any way of sending a variable to this page using server side scripting only and no html, using maybe Response.Redirect
I know that I could use something like
Reponse.Redirect(" and extract the variable from the query string but I would like to be able to send form variables instead if this is possible.

thx in advance
 
assign a session variable maybe???
The secret of life is honesty and fair dealing. If you can fake that, you've got it made.
Groucho Marx (1895-1977)
 
I do not want to change the page that I am linking to in order to retrieved the variable with. It already has a request.form statement in it to get a form variable, so I would like to find out if there is anyway that i can send the variable directly from the server side.

 
I do not want to change the page that I am linking to in order to retrieved the variable. It already has a request.form statement in it to get a form variable, so I would like to find out if there is anyway that i can send the variable directly from the server side.

 
The only way to still have it in the form collection of the request object is to write the page out yourself, putting the value into a hidden variable of a form that points to the page you want to go to, and then submit the form yourself onLoad, since request.form is a read only type of deal (server side, at least).

So:

<%
dim yourValue
yourValue = 5
%>
<script language=javascript>
function doIt(){
document.theForm.submit();
}
</script>
<body onLoad=&quot;doIt();&quot;>
<form name=theForm method=post action=yourPage.asp>
<input type=hidden name=theName value=<%=yourValue%>>
</form>
</body>

It won't be transparent to the user, however. Instead, the page will load, then click, and then your other page will load up. Not a very clean solution.

A better one would be to use session vars as Cheech has suggested.

Either way would work, though.

:)
paul
penny1.gif
penny1.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top