[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Open a new Window

Posted on 2006-04-16
7
Medium Priority
?
210 Views
Last Modified: 2006-11-18
Can anyone help me with this..
I'm trying to open a new window but it fails several times..how do i go abt doing it? That means once i Hit the "View" button it will load  a new page. Thanks..! Urgent please!

The script i have is as below

<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="conn.asp"-->
<%      
      currentyear = year(now())
      selYear = request.QueryString("selYear")
      if selYear = "" then
            selYear = currentyear
      end if

      currentmth= month(now())
      selMonth = request.QueryString("selMonth")
      if selMonth = "" then
            selMonth = currentmth
      end if

      'query_displayVessel = "SELECT * FROM Vessel WHERE Status='VALID' AND VMS_Vessel = 'YES' ORDER BY VesselName "
      query_displayVessel = "SELECT * FROM Vessel WHERE Status='VALID' AND ItemInCons = 'YES' ORDER BY VesselName "
      Set rs_displayVessel = Server.CreateObject("ADODB.Recordset")
      Set rs_displayVessel = conn.Execute(query_displayVessel)
      
%>
<html>
<head>
<title>Lub Oil Consumption Report</title>
<link rel="stylesheet" href="stylesheet.css" type="text/css">
</head>

<body topmargin="0" leftmargin="0">
<table>
<tr>
      <td height="30">&nbsp;</td>
</tr>
</table>
<table align="center" width="80%" border="1" cellspacing="0" cellpadding="5" height="30">
<tr>
    <th align="center" height="40" colspan="4"><b>SELECT VESSEL TO VIEW OIL CONSUMPTION REPORT</b></th>
</tr>

<tr>
    <td align="center" height="40" colspan="4"><b>YEARLY GRAPH:  
      <form name="defaultform" method="post" action="default.asp">
       VESSEL: <select name="MasterID" style="font-size:12px">      
            <option select value="">Please choose</option>
             <%      While NOT rs_displayVessel.EOF%>
           <option value="<%=rs_displayVessel("MasterID")%>"><%=rs_displayVessel("VesselName")%></option>
            <% rs_displayVessel.MoveNext
                  Wend%>
            </select>
            
       
      Year: <select name="selYear" style="font-size:12px">
          <option selected value="<%=selYear%>"><%=selYear%></option>
          <% for k=currentyear-4 to currentyear %>
          <option value="<%=k%>"><%=k%></option>
          <% next %>
        </select>
        &nbsp;
            <input type="submit" name="btn_submit" value="View" style="width:40px; font-size:10px">&nbsp;&nbsp;&nbsp;&nbsp;
            </form></b></td>
</tr>
<%
      query_displayVesselAgain = "SELECT * FROM Vessel WHERE Status='VALID' AND ItemInCons = 'YES' ORDER BY VesselName "
      Set rs_displayVesselAgain = Server.CreateObject("ADODB.Recordset")
      Set rs_displayVesselAgain = conn.Execute(query_displayVesselAgain)
      
      counter = 0
      while NOT rs_displayVesselAgain.EOF
      counter = counter + 1
      if counter mod 3 = 1 then
%>
<tr>
<%
      end if
%>      

      <td class="blue" onmouseover="bgColor='#F3F3F3'" onmouseout="bgColor=''"><a href="javascript:void(0);" onClick="javascript: window.open('quarterlylist.asp?MasterID=<%=rs_displayVesselAgain("MasterID")%>','','location=no,toolbar=yes, menubar=yes,scrollbars=yes,status=yes,resizable=yes,width=1024,height=768');" title='<%=rs_displayVesselAgain("VesselName")%> REPORT'><%=rs_displayVesselAgain("VesselName")%></a></td>
<%
            if counter mod 3 = 0 then
%>
</tr>
<%
            end if
      rs_displayVesselAgain.MoveNext
      Wend
%>
<%
      if Request.Form("btn_submit") = "View" then
      Dim mastID
      Dim sYr
      mastID = request("masterID")
      sYr = request("selYear")
      
      %>
      <script language="JavaScript">
      
      //frm = document.defaultform;
      //parent.opener.location.reload();
      //window.navigate ('yearlygraph.asp?MasterID='+frm.MasterID.value+'&selYear='+frm.selYear.value);
      </script>
            
      <% 'response.Redirect("yearlygraph.asp?MasterID="&request("masterID")&"&selYear="&request("selYear")&"")
            end if
%>
</table>
<font face="Verdana, Arial, Helvetica, sans-serif" style="font-size:10px" color="#999999">
<div align="center">
<hr width="80%" noshade size="1" color="lightgrey" style="margin-top:5px">
  Copyright &copy; 2006 Ocean Tankers Pte. Ltd. All rights reserved.
</div>
</font>
</body>
</html>
<!--#include file="disconn.asp"-->



0
Comment
Question by:Yannie
  • 5
7 Comments
 
LVL 6

Expert Comment

by:Dirar Abu Kteish
ID: 16467230
Hello  Yannie,
as I see that the "View" button is submit button, now when someone clicks on this button, what do u exactly want to do? u said opens a new page, do u still want to show the old one?

-Dirar
0
 

Author Comment

by:Yannie
ID: 16467259
the old one will stay...meaning when it clicks the button..it gets the masterid and selyear parameters and opens a new window totally. the old page remains so pple can select.
0
 
LVL 6

Accepted Solution

by:
Dirar Abu Kteish earned 2000 total points
ID: 16467284
You can change the form action to open on a new page every time u click the submit button
<form name="defaultform" method="post" target="_blank" action="newpage.html">

if you need two submit buttons on the same page please specify

-Dirar
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 6

Expert Comment

by:Dirar Abu Kteish
ID: 16467288
can u please explain why you have this line " if Request.Form("btn_submit") = "View" then ", what is it good for?
0
 
LVL 6

Expert Comment

by:Dirar Abu Kteish
ID: 16467304
I forgot to mention that when submitting the parameters inside the submitted form will be passed to the page that is specified inside the action attribute.. so in your case just modify the line:
<form name="defaultform" method="post" action="default.asp">
to
<form name="defaultform" method="post" target="_blank" action="newpage.html">

and change action="newpage.html" to the page you want to submit the form data to..

then delete

<%
     if Request.Form("btn_submit") = "View" then
     Dim mastID
     Dim sYr
     mastID = request("masterID")
     sYr = request("selYear")
     
     %>
     <script language="JavaScript">
     
     //frm = document.defaultform;
     //parent.opener.location.reload();
     //window.navigate ('yearlygraph.asp?MasterID='+frm.MasterID.value+'&selYear='+frm.selYear.value);
     </script>
         
     <% 'response.Redirect("yearlygraph.asp?MasterID="&request("masterID")&"&selYear="&request("selYear")&"")
          end if
%>
0
 
LVL 2

Expert Comment

by:pashik
ID: 16467589
just write in form target=_blank:
<form name="defaultform" method="post" action="default.asp" target=_blank>
So when u click submit button View it will be opened new window.
0
 
LVL 6

Expert Comment

by:Dirar Abu Kteish
ID: 16467602
Shall he also keep things that he doesn't need?
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question