Click to See Complete Forum and Search --> : Sending Variables Forward to another .asp page!
AnaFyr
11-04-2003, 07:15 PM
I've used variables in my script that were originally captured with the Request.Form method. The values originating from HTML <INPUT TYPE> objects.
I'm using the variables I need to calculate costs on an item, but now I want to send those calculated values forward to an ASP document to be displayed back to the user.
I know I can capture my text field values using Request.Form ("ExampleInputName"). This works great, but is there a way to capture a variable, or send it to the page I need.
gil davis
11-04-2003, 09:16 PM
Since you already know how to get form information, you can take advantage of hidden form fields to pass the value.
Yoou can also take advantage of the query string using Request.Querystring.
AnaFyr
11-05-2003, 10:14 AM
Originally posted by gil davis
Since you already know how to get form information, you can take advantage of hidden form fields to pass the value.
Yoou can also take advantage of the query string using Request.Querystring.
Hi Gil...
Thanx for getting back to me. I understand your explanation, but how would I populate an <INPUT TYPE="hidden"> field with a variable?
gil davis
11-05-2003, 01:21 PM
Depends on when the variable needs to be saved, doesn't it?
Server side:
Response.write "<input type='hidden' value='" & theVar & "'>"
Client Side:
<form onsubmit="this.h1.value=theVar">
<input type="hidden" name="h1">
</form>
AnaFyr
11-05-2003, 03:52 PM
Originally posted by gil davis
Depends on when the variable needs to be saved, doesn't it?
Server side:
Response.write "<input type='hidden' value='" & theVar & "'>"
Client Side:
<form onsubmit="this.h1.value=theVar">
<input type="hidden" name="h1">
</form>
Hi Gil...
Thanks for getting back to me. I just spent the last half hour typing a huge message to you; but I got cut-off and lost everything. I was telling you briefly of my history, and my limited web developing experience, as i"m a fairly recent graduate in that field.
Trying my best to set up a nice website for a small company in town. I'm using a lot of ASP, but limited experience.
If I understand:
Dim NumberOfBolts
NumberOfBolts = Request.Form ("SelectNumberBolts")
Response.Write "<INPUT TYPE='hidden' value=" & NumberOfBolts & ">
Couple of questions.
1. How come your using the & in the value? (Because we'll attach to the stream with text and HTML?)
2. I noticed in the code you sent, there were single quotes alongside double quotes in the value, along with the variable.(Is this intentional?)
Hope to see ya'...AnaFyr...
gil davis
11-05-2003, 04:22 PM
1. How come your using the & in the value? (Because we'll attach to the stream with text and HTML?)The "&" concatenates strings in VB.
2. I noticed in the code you sent, there were single quotes alongside double quotes in the value, along with the variable.(Is this intentional?)I code primarily in JavaScript, and that is the usual way to embed one string inside another. A literal string is delimited by either a pair of double-quotes or a pair of single-quotes. If you need a literal quote inside a string, it can be escaped with a slash ("\""), but that looks pretty weird. I do not know if this is also the case in VB, I just know that it works if I am consistent.
AnaFyr
11-05-2003, 04:54 PM
Thanks for getting back to me Gil...You're a champ.
I knew a little about putting strings inside other strings and escaping characters. If that is the intention, then I understand more now.
So what I'm trying to do is send the valueas a string. How does the called page know if it's a string or variable. My only guess is that the response page will read it as a string, but it's up to me to tell the script to "accept" the string and turn this string into a variable?
If that's the case, how does it know what info was in that variable if it went thru a conversion to string and back again. This puzzles me...lol.
Here's my code to see if I'm on the right track.
Response.Write "<FORM NAME='FinalProcessForm' ACTION='RinoFinalProcess.asp' METHOD='post'>"
Response.Write "<INPUT TYPE='hidden' NAME='HidInTypeNumberOfWeights' VALUE='" & NumberOfWeights & "'>
Response.Write "</FORM>"
Response.Write "<INPUT TYPE='submit' NAME='BTN_ContinueOrder' VALUE='Continue With Order'></STRONG><P>"
I would like it better if I could have shown you with proper formatting as this looks ugly. I'm usually a very neat code- writer. This is what I've got so far.
What do you think?
gil davis
11-05-2003, 05:50 PM
Originally posted by AnaFyr
How does the called page know if it's a string or variable.The action of the form submission creates a variable name/value pair, e.g.: ?myVar=somestring. The Response.Querystring allows you to specify "myVar" and returns "somestring". It is more like an array with named indexes.
My only guess is that the response page will read it as a string, but it's up to me to tell the script to "accept" the string and turn this string into a variable?Guess?!?!? I assumed that you understood that you only pass data (text) between web pages. What that data means is totally up to the receiving web page. You have to write the receiving page with the knowledge of what is coming and what it means.
Response.Write "<INPUT TYPE='hidden' NAME='HidInTypeNumberOfWeights' VALUE='" & NumberOfWeights & "'>This line is missing a quote at the end. Typo?
I would like it better if I could have shown you with proper formatting as this looks ugly. I'm usually a very neat code- writer.You can use [code] and [ /code] or [php] and [ /php] to format your posts. You can also skip the reply box and attach a .txt or .zip were you can control the format to your liking.
rdoekes
11-06-2003, 07:11 AM
Response.Write "<FORM NAME='FinalProcessForm' ACTION='RinoFinalProcess.asp' METHOD='post'>"
Response.Write "<INPUT TYPE='hidden' NAME='HidInTypeNumberOfWeights' VALUE='" & NumberOfWeights & "'>
Response.Write "</FORM>"
Response.Write "<INPUT TYPE='submit' NAME='BTN_ContinueOrder' VALUE='Continue With Order'></STRONG><P>"
your submit button is outside the form:
Response.Write "<FORM NAME='FinalProcessForm' ACTION='RinoFinalProcess.asp' METHOD='post'>"
Response.Write "<INPUT TYPE='hidden' NAME='HidInTypeNumberOfWeights' VALUE='" & NumberOfWeights & "'>"
Response.Write "<INPUT TYPE='submit' NAME='BTN_ContinueOrder' VALUE='Continue With Order'>"
Response.Write "</FORM></STRONG><P>"
AnaFyr
11-06-2003, 10:22 AM
Thanks for getting back to me RD...
Below is the actual code I'm using. I've run the page but doesn't seem to be working...
Can you see what I'm doing wrong?
Code from the form page:
Response.Write "<FORM NAME='FinalProcessForm' ACTION='RinoFinalProcess.asp' METHOD='post'>"
Response.Write "<INPUT TYPE='hidden' NAME='HidInTypeNumberOfWeights' VALUE='NumberOfWeights'>"
Response.Write "</FORM>"
Response.Write "<INPUT TYPE='submit' NAME='BTN_ContinueOrder' VALUE='Continue With Order'></STRONG><P>"
Code from the response page.
Dim NumberOfWeights2
NumberOfWeights2 = Request.Form ("HidInTypeNumberOfWeights")
Response.Write NumberOfWeights2
When I run this script, the page doesn't return an error; but it doesn't seem to resolve either. It seems to stay in limbo...
What do you think?
AnaFyr
11-06-2003, 10:24 AM
Originally posted by gil davis
The action of the form submission creates a variable name/value pair, e.g.: ?myVar=somestring. The Response.Querystring allows you to specify "myVar" and returns "somestring". It is more like an array with named indexes.
Guess?!?!? I assumed that you understood that you only pass data (text) between web pages. What that data means is totally up to the receiving web page. You have to write the receiving page with the knowledge of what is coming and what it means.
This line is missing a quote at the end. Typo?
You can use [code] and [ /code] or [php] and [ /php] to format your posts. You can also skip the reply box and attach a .txt or .zip were you can control the format to your liking.
Hi Gil...
Below is the actual code I'm using. I've run the page but doesn't seem to be working...
When I run this script, the page doesn't return an error; but it doesn't seem to resolve either. It seems to stay in limbo...
Can you see what I'm doing wrong?
Code from the form page:
Response.Write "<FORM NAME='FinalProcessForm' ACTION='RinoFinalProcess.asp' METHOD='post'>"
Response.Write "<INPUT TYPE='hidden' NAME='HidInTypeNumberOfWeights' VALUE='NumberOfWeights'>"
Response.Write "</FORM>"
Response.Write "<INPUT TYPE='submit' NAME='BTN_ContinueOrder' VALUE='Continue With Order'></STRONG><P>"
Code from the response page.
Dim NumberOfWeights2
NumberOfWeights2 = Request.Form ("HidInTypeNumberOfWeights")
Response.Write NumberOfWeights2
What do you think?
gil davis
11-06-2003, 01:54 PM
Originally posted by AnaFyr
Response.Write "<FORM NAME='FinalProcessForm' ACTION='RinoFinalProcess.asp' METHOD='post'>"
Response.Write "<INPUT TYPE='hidden' NAME='HidInTypeNumberOfWeights' VALUE='NumberOfWeights'>"
Response.Write "</FORM>"
Response.Write "<INPUT TYPE='submit' NAME='BTN_ContinueOrder' VALUE='Continue With Order'></STRONG><P>"
Response.Write "<FORM NAME='FinalProcessForm' ACTION='RinoFinalProcess.asp' METHOD='post'>"
Response.Write "<INPUT TYPE='hidden' NAME='HidInTypeNumberOfWeights' VALUE='NumberOfWeights'>"
Response.Write "<INPUT TYPE='submit' NAME='BTN_ContinueOrder' VALUE='Continue With Order'>"
Response.Write "</FORM>"