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

Need help with window.open

Status
Not open for further replies.

PhoneGuyNJ

Technical User
Dec 7, 2004
203
0
0
US
I am trying to make a window pop in an ASP page that bascially will pass order information to a subsite that makes a printout of their gift. I am having problems with the window.open command, and have tried about 10 different variations. Below is a snipped of the code area I need assistance with. Any help is apprieciated:

'--> Retrieve Order Total
if len(qIdOrder) > 0 and IsNumeric(qIdOrder) then
mySQL = "SELECT total,orderStatus " _
& "FROM cartHead " _
& "WHERE idOrder = " & validSQL(qIdOrder,"I") & " "
set rsTemp = openRSexecute(mySQL)
if not rstemp.eof then
qTotal = rsTemp("total")
orderStatus = rsTemp("orderStatus")
end if
call closeRS(rsTemp)

' check to see the user bought a season pass
mySQL = "SELECT COUNT(*) AS TOTAL " & _
"FROM cartRows " & _
"WHERE idProduct = 59 " & _
"AND idOrder = " & validSQL(qIdOrder,"I") & " "


set rsTemp = openRSexecute(mySQL)
if not rstemp.eof then
seasonPassTotal = rsTemp("total")
end if
call closeRS(rsTemp)

if seasonPassTotal <> 0 then

Response.Write"<script>window.open(' & qIdOrder,"Season Pass Receipt", "status=yes,toolbar=no" ');</script>"
end if
end if

%>
<!--#include file="../UserMods/_INCtemplate_.asp"-->
<%

'Close Database Connection
call closeDB()
 
1. Your usage of double quotes and single quotes is all over the place...

2. The second paramater of window.open is the window name and cannot (or should not) contain any spaces

try splitting up the VBScript and Javascript:

Code:
<% if seasonpasstotal <> 0 then %>
 <script>	
 window.open("[URL unfurl="true"]http://www.cppm3.com/adventure/receipts/default.aspx?orderId=<%=qIdOrder%>","SeasonPassReceipt",[/URL] "status=1,toolbar=0");
</script>
<% end if %>

Or if you absolutley want to try and make some sort of an "impression" by using "100%" vbscript code (why you would, I don't know)

Code:
<%
if seasonpasstotal <> 0 then
response.write "<script>window.open(""[URL unfurl="true"]http://www.cppm3.com/adventure/receipts/default.aspx?orderId="[/URL] & qIdOrder & """,""SeasonPassReceipt"", ""status=1,toolbar=0"");</script>"
  end if
%>

The first example (IMO) is easier to read and maintain. Also, be sure to include the "language" and "type" attributes to your script tag - I didn't include them, but you should....


--------
GOOGLE is a great resource to find answers to questions like "how do i..."

If you don't know exaclty what you want to do or what to search on, try Google Suggest: --------
I have recently been semi-converted to ensuring all my code (well most of it) works in both javascript and non-javasc
 
With both of those, I get page not found, but I dont get any more ASP errors... and the order does complete..


Sorry, I am new at modifying code but am getting there and willing to do all the research, but I had someone write this subsite to come up and print a season pass for the buyer, but they up and left the project hanging.
 
where do you get the page not found - on the popup window?

If yes, does the page cppm3.com/adventure/receipts/default.aspx exist?

What's in that page? I'm assuming once it completes the order it redirects the user to another page - maybe that page is missing....





--------
GOOGLE is a great resource to find answers to questions like "how do i..."

If you don't know exaclty what you want to do or what to search on, try Google Suggest: --------
I have recently been semi-converted to ensuring all my code (well most of it) works in both javascript and non-javasc
 
I think I may have found the issue, let me do a little more testing and I will post my results.. :)
 
Ok the page not found was fixed.
I used the first option and I get:

Expected Statement
<%
^
Must be missing one..
 
I am pasting a little more code... I tried option B as well, and same result.. sorry to be a pain.. :)




<!--#include file="../UserMods/_INCpayIn_.asp"-->
<%

dim formattedDateTime
'Get a Date and Time formatted to the user's specifications
formattedDateTime = formatTheDate(currDateTime("DT",timeOffSet)) & " " & currDateTime("T",timeOffSet)


'--> Set to zero length string if still incorrect
if len(qIdOrder) = 0 or not(IsNumeric(qIdOrder)) then
qIdOrder = ""
statusInd = ""
end if

'--> Retrieve Order Total
if len(qIdOrder) > 0 and IsNumeric(qIdOrder) then
mySQL = "SELECT total,orderStatus " _
& "FROM cartHead " _
& "WHERE idOrder = " & validSQL(qIdOrder,"I") & " "
set rsTemp = openRSexecute(mySQL)
if not rstemp.eof then
qTotal = rsTemp("total")
orderStatus = rsTemp("orderStatus")
end if
call closeRS(rsTemp)

'Cavallo Communications
' check to see the user bought a season pass
mySQL = "SELECT COUNT(*) AS TOTAL " & _
"FROM cartRows " & _
"WHERE idProduct = 59 " & _
"AND idOrder = " & validSQL(qIdOrder,"I") & " "


set rsTemp = openRSexecute(mySQL)
if not rstemp.eof then
seasonPassTotal = rsTemp("total")
end if
call closeRS(rsTemp)

<%
if seasonpasstotal <> 0 then
response.write "<script>window.open("" & qIdOrder & """,""SeasonPassReceipt"", ""status=1,toolbar=0"");</script>"
end if
%>
<!--#include file="../UserMods/_INCtemplate_.asp"-->
<%

'Close Database Connection
call closeDB()


'**********************************************************************
'Main Shopping Cart Display Area
'**********************************************************************
sub cartMain()
%>
<!-- Outer Table Cell -->ƒƒ
<table border="0" cellpadding="0" cellspacing="0" width="450">
<tr>
<td>
<!-- Heading -->
<table border="0" cellpadding="2" cellspacing="0" width="100%">
<tr>
<td nowrap valign="middle" class="CPpageHead">
<% if statusInd = "error" then %>
<b><font color="red">
<%=LangText("GenPayErrorHdr","")%></font></b>
<% else %>
<b>
<%=LangText("GenPaySuccessHdr","")%></b>
<% end if %>
</td>
</tr>
 
PhoneGuyNJ said:
Must be missing one..
..almost - you have one too many

Code:
...

  set rsTemp = openRSexecute(mySQL)
    if not rstemp.eof then
        seasonPassTotal = rsTemp("total")
    end if
    call closeRS(rsTemp)

[s][COLOR=red] <% [/color][/s]
if seasonpasstotal <> 0 then
response.write "<script>window.open(""[URL unfurl="true"]http://www.cppm3.com/adventure/receipts/default.aspx?orderId="[/URL] & qIdOrder & """,""SeasonPassReceipt"", ""status=1,toolbar=0"");</script>"
  end if
%>

...

--------
GOOGLE is a great resource to find answers to questions like "how do i..."

If you don't know exaclty what you want to do or what to search on, try Google Suggest: --------
I have recently been semi-converted to ensuring all my code (well most of it) works in both javascript and non-javasc
 
also, please wrap any code you post around TGML tags:

Code:
...code goes here...

it's a lot easier to read :)



--------
GOOGLE is a great resource to find answers to questions like "how do i..."

If you don't know exaclty what you want to do or what to search on, try Google Suggest: --------
I have recently been semi-converted to ensuring all my code (well most of it) works in both javascript and non-javasc
 
Sorry about the formatting. I will make sure I follow that.

It works! (Was also missing an "end if" but I put that in)

Now if I can only find someone to work for me with that amount of knowlege! :)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top