Click to See Complete Forum and Search --> : Sending variable content forward...
AnaFyr
11-18-2003, 03:50 PM
Hi y'all...
I've submitted a thread about this a couple of weeks ago. I had a couple of responses. Thank You. You know who you are. Although trying many possibilities, I still can't make it do what I want it to do.
I've created a table in which to display final order calculations back to the user. The cells of the table is populated with variables. This page is only to show the user his order to date and show him what it would cost if he actually proceeded with the order. If they want to cancel, they can.
But; if they wanted to continue, I take them to a different page, but I also want to show them their totals again.
My problem is this:
I've already created the table using variables. Those variables change according to the user's selections on the form. I want to send the info in the variable, forward to another ASP page.
I've tried this:
!COMMENT--HERE, I'M CREATING A HIDDEN INPUT-TYPE ON THE FORM WITH IT'S VALUE SET TO THE NAME OF THE VARIABLE ("NumberOfWeights")
Response.Write "<INPUT TYPE='hidden' NAME='HidInTypeNumberOfWeights' VALUE='NumberOfWeights'>"
!COMMENT--THIS IS WHAT I HAVE ON MY CAPTURE PAGE
Dim NumberOfWeights2
NumberOfWeights2 = Request.Form ("HidInTypeNumberOfWeights")
This is my result:
Thank you for ordering NumberOfWeights hockey weights.
It's returning the name of the variable and not it's value.
Don't know what else to do!
Somebody, HELP!
gil davis
11-18-2003, 04:05 PM
Originally posted by AnaFyr
!COMMENT--HERE, I'M CREATING A HIDDEN INPUT-TYPE ON THE FORM WITH IT'S VALUE SET TO THE NAME OF THE VARIABLE ("NumberOfWeights")
Response.Write "<INPUT TYPE='hidden' NAME='HidInTypeNumberOfWeights' VALUE='NumberOfWeights'>"
!COMMENT--THIS IS WHAT I HAVE ON MY CAPTURE PAGE
Dim NumberOfWeights2
NumberOfWeights2 = Request.Form ("HidInTypeNumberOfWeights")
This is my result:
Thank you for ordering NumberOfWeights hockey weights.Exactly what I would have expected, and exactly what you coded.
You are having a real problem with using logic.
Where is "NumberOfWeights" calculated? Is it on the server side, or the client side?
If the calculation is on the client side, you are going to have to use client side scripting to set the value of the hidden field equal to the variable when you are ready to transmit it.
document.formName.HidInTypeNumberOfWeights.value = NumberOfWeights;
If the calculation is on the server side, then you need to change your response.write statement.
Response.Write "<INPUT TYPE='hidden' NAME='HidInTypeNumberOfWeights' VALUE='" + NumberOfWeights + "'>"
The capture page is fine the way it is.
slyfox
11-18-2003, 04:08 PM
the value you're getting thru at the end of the day is then the correct value..
you're asking for the value of "HidInTypeNumberOfWeights" and it gives you "NumberOfWeights"... which is right... if you want the value to be different you must type something like "123" in the textbox and you will get the value "123" on your page requesting the information ("HidInTypeNumberOfWeights")...
too difficult?
AnaFyr
11-18-2003, 04:14 PM
Originally posted by gil davis
Exactly what I would have expected, and exactly what you coded.
You are having a real problem with using logic.
Where is "NumberOfWeights" calculated? Is it on the server side, or the client side?
If the calculation is on the client side, you are going to have to use client side scripting to set the value of the hidden field equal to the variable when you are ready to transmit it.
document.formName.HidInTypeNumberOfWeights.value = NumberOfWeights;
If the calculation is on the server side, then you need to change your response.write statement.
Response.Write "<INPUT TYPE='hidden' NAME='HidInTypeNumberOfWeights' VALUE='" + NumberOfWeights + "'>"
The capture page is fine the way it is.
Hi again Gil...
Hope you're fine?
I had to go out of town, and am finally back tackling this beast. lol
Thanks again for responding to me. I will try to change a few things to see what happens, and I'll get back to you.
See ya...
Ana.
AnaFyr
11-18-2003, 04:34 PM
Originally posted by slyfox
the value you're getting thru at the end of the day is then the correct value..
you're asking for the value of "HidInTypeNumberOfWeights" and it gives you "NumberOfWeights"... which is right... if you want the value to be different you must type something like "123" in the textbox and you will get the value "123" on your page requesting the information ("HidInTypeNumberOfWeights")...
too difficult?
Hey Slyfox.
Thanks for responding.
I'm actually trying to send the variable's content. That content is populated dynamically thru a pull-down menu.
If the user selects 10, I want the value "10" sent to the next page. Not the name of the variable which is what I've been getting.
The problem is, I'm not getting the values directly from the form objects. Users have already made their selections on the previous page. They're no longer in a form.
Hope this will give you a better understanding of my plight!
AnaFyr...
slyfox
11-19-2003, 01:25 PM
Hi
Here is a quick sample that works..
First page posting the info:
<form name="form1" action="test.asp" method="post">
<select name="menu1">
<option selected>select</option>
<option>1</option>
<option>2</option>
<option>aaaaa</option>
<option>bbbbb</option>
</select>
<input type="submit" name="send" value"Send">
</form>
Second page requesting the info:
<%@LANGUAGE="JAVASCRIPT"%>
<%
var getIt = Request.Form("menu1");
Response.Write(getIt);
%>
Is this what you were looking for?
Hope it helps;)
AnaFyr
11-19-2003, 09:30 PM
Originally posted by slyfox
Hi
Here is a quick sample that works..
First page posting the info:
<form name="form1" action="test.asp" method="post">
<select name="menu1">
<option selected>select</option>
<option>1</option>
<option>2</option>
<option>aaaaa</option>
<option>bbbbb</option>
</select>
<input type="submit" name="send" value"Send">
</form>
Second page requesting the info:
<%@LANGUAGE="JAVASCRIPT"%>
<%
var getIt = Request.Form("menu1");
Response.Write(getIt);
%>
Is this what you were looking for?
Hope it helps;)
Hey Sly,
Already know how to capture form elements. Thanks for the code. What I need to do is capture the content of a variable.
Let's put it this way, I need to populate an <INPUT TYPE="hidden"> with the value of a variable. It happens to be a price. e.g. 23.65.
slyfox
11-20-2003, 01:53 AM
oh i understand... glad you got it right;)