SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Zealot kryptokid's Avatar
    Join Date
    Nov 2001
    Location
    Brisbane, Australia
    Posts
    108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Print then change window.location

    I've got a page where the user enters some details into a form, once they click submit, a new page opens up with all the details neatly organised. My plan is to have that new page automatically print once it is open and then change the URL to a generic page where the user can choose their next action.

    I can get the page to automatically print, but once I add the window.location script the Print script is bypassed.

    Does anybody know how to fix this?

  2. #2
    SitePoint Addict Jack Matier's Avatar
    Join Date
    Feb 2005
    Posts
    292
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    can you post the code/page in question?

  3. #3
    SitePoint Zealot kryptokid's Avatar
    Join Date
    Nov 2001
    Location
    Brisbane, Australia
    Posts
    108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's actually the second part of an ASP page so I've only included the scripting for that part. Plus it's probably only the stuff above line 17 that'll be of interest.

    Code:
    <script language="JavaScript" type="text/JavaScript">function relocate(){
    var decision = confirm("Do you want to add another record?");
    if (decision == true) {
    window.location("archive-addrecord.asp");
    }else {
    window.location("index.asp");
    }
    }
    </script>
     
    <%set rs6 = con.execute("insert into mtgravatt(Campus, ArchivePreparedBy, Team, ManagerofSection, YearRecordsCompleted, TypeofRecord, DirectGrant, TraineesorApprenticeships, Notes, DisposalDate, ArchiveRoom, Location, Relocate) values ('" & T1 & "', '" & T2 & "', '" & T3 & "','" & T4 & "'," & T5 & ",'" & T6 & "','" & T7 & "','" & T8 & "','" & T9 & "'," & T10 & ",'" & T11 & "','" & T12 & "','" & T13 & "')")
    set rs7 = con.execute("select TOP 1 * FROM mtgravatt WHERE ArchivePreparedBy = '" &T2&"' ORDER BY RecordID desc")%>
     
    <script language="javascript">
    window.print();
    relocate();
    </script>
     
    <table width="595" border="0" cellpadding="0">
    <tr>
    <td width="134"><img src="images/MITrgbLANDSCAPEsmall.jpg" width="126" height="33"></td>
    <td width="339"><div align="center" class="headingfont style2">Archive Cover Sheet</div></td>
    <td width="114"><div align="right"><img src="images/tafelongcolour.jpg" width="105" height="33"></div></td>
    </tr>
    <tr>
    <td colspan="3" class="coverfont" style="padding-top: 20px; padding-bottom: 20px;">
    	<p><strong>THE FOLLOWING ARE REQUIRED ARCHIVING PROCEDURES TO BE COMPLETED BY THE ADMINISTRATION OFFICER BEFORE COLLECTION</strong></p>
    	<ul>
    	 <li>Refer to instructions for preparing records for Archiving - Appendix 1 INST_PRO.402</li>
    	 <li>Only originals are to be archived</li>
    	 <li>Records must be the same year, classification and team</li>
    	 <li>Complete Section 1 only</li>
    	 <li>Remove all documents from ring binders, suspension files, etc.</li>
    	 <li>Attach this completed form to the bundle of documents (with legal tape)</li>
    	 <li>Please ensure writing is legible and where possible informationm to be typed</li>
    	</ul>	</td>
    </tr>
    <tr bgcolor="#CCCCCC" >
    <td colspan="3" class="headingfont">SECTION 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Details to be completed by team member requesting removal of archives</td>
    </tr>
    <tr>
    <td colspan="3" style="padding-top: 20px; padding-bottom: 20px;">
    	<table width="100%" border="0" cellspacing="0" class="coverfont">
    	 <tr>
    	 <td valign="top" class="tableborder" ><strong>Name</strong></td>
    	 <td valign="top" class="tableborder" >&nbsp;<%= t2%></td>
    	 </tr>
    	 <tr>
    	 <td valign="top" class="tableborder" ><strong>Campus</strong></td>
    	 <td valign="top" class="tableborder" >&nbsp;<%= t1%></td>
    	 </tr>
    	 <tr>
    	 <td valign="top" class="tableborder" ><strong>Team</strong></td>
    	 <td valign="top" class="tableborder" >&nbsp;<%= t3%></td>
    	 </tr>
    	 <tr>
    	 <td valign="top" class="tableborder" ><strong>Manager</strong></td>
    	 <td valign="top" class="tableborder" >&nbsp;<%= t4%></td>
    	 </tr>
    	 <tr>
    	 <td valign="top" class="tableborder" ><strong>Year Records Completed</strong></td>
    	 <td valign="top" class="tableborder" >&nbsp;<%= t5%></td>
    	 </tr>
    	 <tr>
    	 <td valign="top" class="tableborder" ><strong>Classification</strong></td>
    	 <td valign="top" class="tableborder" >&nbsp;<%= t6%></td>
    	 </tr>
    	 <tr>
    	 <td valign="top" class="tableborder" ><strong>Does this archive contain Apprentice or Traineeship Records?</strong></td>
    	 <td valign="top" class="tableborder" >&nbsp;<%= t8%></td>
    	 </tr>
    	 <tr>
    	 <td valign="top" class="tableborder" ><strong>Does this archive contain Direct Grant Student Records?</strong></td>
    	 <td valign="top" class="tableborder" >&nbsp;<%= t7%></td>
    	 </tr>
    	 <tr>
    	 <td valign="top" class="tableborder" ><strong>Notes (Please provide specific detail)</strong></td>
    	 <td valign="top" class="tableborder" >&nbsp;<%= t9%></td>
    	 </tr>
    	 </table>
    </td>
    </tr>
     
    <tr>
    <td colspan="3" style="padding-top: 20px; padding-bottom: 20px;">
    	<table width="100%" class="coverfont" style="border: 1px solid #000000;">
    	 <tr bgcolor="#CCCCCC" >
    	 <td colspan="3"><b class="headingfont">SECTION 2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Archiving officer's use only</b></td>
    		</tr>
    	 <tr>
    	 <td><strong>Record Number</strong> <%= rs7("RecordID")%></td><td><strong>Disposal Date</strong> <%= T10%></td><td><strong>Does this Archive require relocating</strong> <%= T13%></td>
    	 </tr>
    	 <tr>
    	 <td colspan="2"><strong>Archive Room</strong> <%= t12%></td><td><strong>Location</strong> <%= t11%></td>
    	 </tr>
    	 </table>
    </td>
    </tr>
    </table>

  4. #4
    SitePoint Addict Jack Matier's Avatar
    Join Date
    Feb 2005
    Posts
    292
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That is interesting... I tried this and it seemed to go in the right direction from there.:
    Code:
    window.print();
    setTimeout('relocate();',1);
    window.location didn't open up a new window for me though.

  5. #5
    SitePoint Zealot kryptokid's Avatar
    Join Date
    Nov 2001
    Location
    Brisbane, Australia
    Posts
    108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Jack, I'll try that out.

    In my original post my wording was incorrect, I was only trying to change the URL not have a totally new page open up.

  6. #6
    SitePoint Addict Jack Matier's Avatar
    Join Date
    Feb 2005
    Posts
    292
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It would seem IE opens up both things..

    If it means anything to you, this seems like a very annoying thing on the user end. What's wrong with just providing a link if they'd like to print it?

  7. #7
    SitePoint Zealot kryptokid's Avatar
    Join Date
    Nov 2001
    Location
    Brisbane, Australia
    Posts
    108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's an internal Archive Records system and they have to print it as it's a coversheet for the archives.

    I can deal with it opening the Print Dialogue Box and Confirmation Dialogue Box at the same time. It's better than having one open and not the other.

    Thanks, Jack. I wouldn't have even thought about using SetTimeout without your help.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •