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

Pass text box input to a variable in a window.open stmnt on same page

Status
Not open for further replies.

iteach2

Technical User
Sep 16, 2001
120
US
Hi Gurus,

I am trying to set a variable that is located within a window.open statement on the same page. The window.open statement looks like this:

onClick="window.open('<%RSBUSINESS%>&item_name=<%RSITEM%>&on0=???

Variables business and itemname are set by data coming from a database.

Variable on0 is the one that is giving me the problem.

I need to load variable on0 with the input of a textbox on the same page, the text box that looks like this:

<input type="hidden" name="on0"></td>

I tried using the session variable but it only works if I hard code the value like this:


<%Dim n
n = 17
If (Session("Session_1") = "") Then
Session("Session_1") = 0
Else
Session ("Session_1") = n
End If
%>

I would like to have n be set with the input of the textbox on0. Rather than hardcoding the 17.

This code works when I hardcode n, in other words when the new window opens the value of 17 is there.

To put it plainly, I want to pass the input from hidden textbox on0 to variable n . Once that is done I will add it to the session and set the on0 in the window.open statement equal to the session. That part works...

Thanks for your help
 
This should do it:

[tt]
onClick='window.open("<%RSBUSINESS%>&item_name=<%RSITEM%>&on0=" + document.form_name.on0.value)'
[/tt]

*cLFlaVA
----------------------------
A pirate walks into a bar with a huge ship's steering wheel down his pants.
The bartender asks, "Are you aware that you have a steering wheel down your pants?"
The pirate replies, "Arrrrr! It's driving me nuts!
 
Hi CLFlava,

Can you write the code so that more arguments can come after it. I have more options to include after and it looks like you closed the statement out with ")'" how do you write it to so that more arguments can come after..

like:

on0="document.blah.blah.blah & returname=<%%>
 
[tt]
onClick='window.open("<%RSBUSINESS%>&item_name=<%RSITEM%>&on0=" + document.form_name.on0.value + "&returname=<%RETURNAME%>&anothervariable=<%ANOTHERVAR%>")'
[/tt]

*cLFlaVA
----------------------------
A pirate walks into a bar with a huge ship's steering wheel down his pants.
The bartender asks, "Are you aware that you have a steering wheel down your pants?"
The pirate replies, "Arrrrr! It's driving me nuts!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top