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!

move data from form to ASP Value

Status
Not open for further replies.

tomhughes

Vendor
Joined
Aug 8, 2001
Messages
233
Location
US
Does anyone know how to move data from a form to an ASP value, on the same page ???
 
Need a bit more info, But I'm guessing you want to declare a session variable.

in that case you'd be like
<%
Dim strRecipients
Dim strFirstName
Dim strLastName
Dim strDimmyDim

strRecipients = Request.Form(&quot;Recipients&quot;)
strFirstName = Request.Form(&quot;FirstName&quot;)
strLastName = Request.Form(&quot;LastName&quot;)
strDimmyDim = Request.Form(&quot;DimmyDim&quot;)
%>

However this will work on a page AFTER the forms submitted. It can't get values that are not there yet.

&quot;Insert witty remark here&quot;

Stuart
 
The site consists of a frameset with a top and bottom frame
The top frame has two butttons that increment, or decrement a value, and (by means of the framset) pass the value to the bottom frame where it is displayed. I need to convert the value that is passed to the bottom frame to a variable in ASP. Please find the code for all three files below:


Top Frame - &quot;frames_t.asp&quot;

<html>
<script language=&quot;JavaScript&quot;>
<!--
var n = 0 ;
function MM_callJS(jsStr) { //v2.0
return eval(jsStr)
}
n = document.forms[0].value

//-->
</script>




<body>
<center>

<form>
<input type=&quot;hidden&quot; name=&quot;i&quot; value=&quot;&quot;>
<input type=&quot;button&quot; value=&quot;click to increment&quot; onClick=&quot;n++; document.forms[0].i.value = 'n is now:' + n; parent.passText(n);&quot;>
<input type=&quot;button&quot; value=&quot;click to decrement&quot; onClick=&quot;n--; document.forms[0].i.value = 'n is now:' + n; parent.passText(n);&quot;>
</form>

</center></body>
</html>
------------------------------------
Bottom Frame - &quot; frames_b.htm&quot;

<html>
<body>
<form name=yourform>
<input type=text name=msg size=35 value=&quot;&quot;>
</form>
</body>
</html>
------------------------------------


Frameset - &quot; test.htm&quot;

<html>
<head>
<script language=&quot;JavaScript&quot;>
<!--
function passText(CountJS) {
top.frames['right'].document.yourform.msg.value = CountJS;

}
-->
</script>
</head>
<frameset rows=&quot;300,*&quot; frameborder=1>
<frame name=&quot;left&quot; src=&quot;frames_t.htm&quot;>
<frame name=&quot;right&quot; src=&quot;frames_b.asp&quot;>
</frameset><noframes></noframes>


</html>
 
if you have the bottom form as a GET method, you can do what I suggested up above. &quot;Insert witty remark here&quot;

Stuart
 
schase,

Be careful what you call a Session Variable. The Request.Forms you wrote about are not the same as session variables.

The scope of a variable stored in the Session object is limited to the length of the connection of a user to a site. Therefore you can keep a variable handy from one page to the next. The variables that you have shown code for will only last for the page that they are being used.

Just a thought. Ryan
rmindorff@hotmail.com
 
I have tried the code below, but it doesn't appear to work.


<%@LANGUAGE=&quot;VBSCRIPT&quot; %>

<script language=&quot;JavaScript&quot;>
var CountJS ;
<% Session(&quot;Count&quot;) %> = CountJS ;
</script>

<%
Session(&quot;Count&quot;) = Request.Form(&quot;textfield&quot;)
Response.Write Session(&quot;Count&quot;)
%>

<html>
<body>
<p>

</p>
<form name=&quot;yourform&quot; method=&quot;get&quot; action=&quot;test.htm&quot;>
<input type=&quot;hidden&quot; name=&quot;textfield&quot; value=&quot;CountJS&quot;>
</form>
<p>&nbsp; </p>


</body>
</html>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top