Author |
Topic |
bubberz
Constraint Violating Yak Guru
289 Posts |
Posted - 2006-02-09 : 16:01:54
|
Here's the code so far, and it says strWPID is not defined.This is an .asp page:if (!navigator.javaEnabled()) {window.location = "javanotenabled.asp";} else {<%strWPID = session("sessionWPID") strDB = session("sessionDB")strPC = session("sessionPC")strCA = session("sessionCA")strWPN = session("sessionWPN")%>window.location = "MainMenu.asp?WPID="+strWPID+"&DB="+strDB+"&PC="+ strPC +"&CA=" + strCA +"&WPN="+ strWPN;//vername="+vername+"&verno="+verno;}...but it's not working..any suggestions?It says javascript error of:strWPN is not defined |
|
X002548
Not Just a Number
15586 Posts |
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2006-02-09 : 16:38:36
|
That's because it is out of scope -- you have defined those variables in your ASP code running on the SERVER, but your javascript is running in the CLIENT browser.All you should need to do is something like this:window.location = "MainMenu.asp?WPID=<%= strWPID %>&DB=<%= strDB %>&PC=<%= strPC %>&CA=<%= strCA%>&WPB=<%= WPN %>"That way your ASP variables are in scope since they are now in <% %> blocks, and will be processed on the server. |
|
|
bubberz
Constraint Violating Yak Guru
289 Posts |
Posted - 2006-02-12 : 09:26:16
|
jsmith8858 / X002548Thanks guys!That's exactly what I came to realize, and used that exact code to make it work on Thursday!Thanks for the interest and replies! |
|
|
bubberz
Constraint Violating Yak Guru
289 Posts |
Posted - 2006-02-16 : 11:14:00
|
All,We're trying to use the Javascript function rather than the hyperlink (which works), but the following code won't work for production...except the hard coded line for the URL://window.location = "MainMenu.asp?vername="<%=session("sessionWPID")%>"&DB="<%=session("sessionDB")%>"&PC="<%=session("sessionPC")%>"&CA="<%=session("sessionCA")%>"&WPN="<%=session("sessionWPN")%>;//window.location = "MainMenu.asp?WPID="+<% session("sessionWPID")%>;//window.location = "MainMenu.asp?vername="+<%=session("sessionWPID")%>+"&DB="+<%=session("sessionDB")%>+"&PC="+<%=session("sessionPC")%>+"&CA="+<%=session("sessionCA")%>+"&WPN="+<%=session("sessionWPN")%>;//window.location = <a href="http://localhost/Work_PackageVBConvert_P3E/CC/MainMenu.asp?WPID=<%=session("sessionWPID")%>&DB=<%=session("sessionDB")%>&PC=<%=session("sessionPC")%>&CA=<%=session("sessionCA")%>&WPN=<%=session("sessionWPN")%>"></a>window.location = "MainMenu.asp?WPID=01.06.12.01.02.01.07.01-FY06-0.1&DB=wi&PC=C3F6&CA=0107&WPN=0100";We need to use the session objects...any help is appreciated! |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2006-02-16 : 11:56:22
|
What do you mean by "it doesn't work?" What gets rendered on the page? Are you sure your session variables are set? did you try simply outputting the URL to the page as text to make sure you are building the URL's correctly?Also, do you have a closing quotation on the javascript code that you are creating? (doesn't look like it from what I can see) |
|
|
bubberz
Constraint Violating Yak Guru
289 Posts |
Posted - 2006-02-16 : 13:28:31
|
jsmith8858,Thanks for the reply!What I should have said is we were getting a Javascript error about the line with the session objects in the window.location query string.The error was an expected ";"Yes...there is a closing quote tag.Thanks! |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2006-02-16 : 13:58:35
|
So did you solve it? |
|
|
bubberz
Constraint Violating Yak Guru
289 Posts |
Posted - 2006-02-16 : 14:57:09
|
Yes, we ended up going to the original version of the page and using a "worker" page to set the session variables from our applications query string.We're not using the session objects, but variables set within the JavaScript function |
|
|
|