PDA

View Full Version : Javascript Validation & ASP Querystring?


JVRudnick
08-29-2005, 10:54 PM
Hey all...
I have an asp page, where the user fills in a form which is validated. If the validation is successful, then the user is redirected to a page where all the items are nicely formatted for them to print the page out.

However, I now must add a small routine to that asp page, to write some data to an MSSQL dbase, and I can't it seems pass 2 querystrings from one page to the other...

SendingPage.asp page...
<snip>lots of form field validations up here...then

else {
window.open('contests/vaselineframe2005/print_en.asp?contestID=58');

As you can see, I can pass one querystring just fine...

But how do I add this one from this text input...

<input type="text" name="txtPIN" size="30" maxlength="80" class="text">

It seems that I can't use "&PIN=request.form("txtPIN") to work...

nor "&PIN='<%=request.form("txtPIN")%>' either....

Why? Dang apostrophes!!!


Jim

BaldEagle
08-30-2005, 12:58 AM
Have you tried :



else {
myVar = document.getElementsByName("txtPIN").value;
window.open('contests/vaselineframe2005/print_en.asp?contestID=58&PIN='+myVar);

It seems that it should work.

BaldEagle

JVRudnick
08-30-2005, 10:37 PM
I have tried to use your code --

myVar = document.getElementsByName("txtPIN").value;
window.open('contests/vaselineframe2005/print_en.asp?contestID=58&PIN='+myVar);

But when I go to the next page, I used --

number = Request.QueryString("contestID")

PIN = Request.QueryString("PIN")

response.write("Number is : ") & number & "PIN is :" & PIN

response.end

And the resulting page then is --

Number is : 58PIN is :undefined

SO as you can see, PIN aint getting thru....

Why anyone know?

Jim

Basscyst
08-31-2005, 01:39 AM
Perhaps:


else {
myVar = "<%=Request("pin")%>";
window.open('contests/vaselineframe2005/print_en.asp?contestID=58&PIN='+myVar);


Basscyst

BaldEagle
08-31-2005, 02:17 AM
Not sure why the getElementsByName didn't work but this does as I tested it:

myVar = document.loader.txtPIN.value;

replace loader with your form name.

BaldEagle

[edit] Oh, and I apologize for giving you a fix that didn't work and I didn't test.