Results 1 to 5 of 5

Thread: Executing function in new window

  1. #1
    Join Date
    Nov 2002

    Executing function in new window

    On page1, I have a form. After filling in the fields, I want the user to be able to pop up a new window that will display selected field information from that form. After viewing this pop-up, the user should close the new window and return to the original form page (page1) and hit the Submit button to send the form data using FormMail.

    I have the field display script working, as well as the form data send script. All I need is to figure out how to get the form display script to execute in the popped up window. The reason I want it to pop-up is because I can't seem to pass the form data from page1 through the display page to be sent using FormMail.

    To see what I have so far, please go to www.todaysmenu.ca/plan/tester.htm. The part that doesn't work here is that the e-mail generated by FormMail doesn't include the data.

    I also realize that my scripts are quite kludgy, and that I could be making use of arrays in spots, so if anyone has any suggestions there as well, I'd appreciate it and would be happy to link to you from my code.


  2. #2
    Join Date
    Nov 2002
    I went to your page but wasn't shure where you were talking about. However, from what I understand you have a JavaScript function on page 1 and you want to execute it on the pop-up page. If this is all you want to do, save the javascript function in a .js file and then link to it in your pop-up page with the following code:
    <script language="JavaScript" src="yourFileName.js">
    Then you can call the function as you normally would. I hope this helps.


  3. #3
    Join Date
    Nov 2002
    Thanks for your reply, Jeremy. I did try what you've suggested, and tried to execute the function on body onLoad but it doesn't work. I wonder if it's because what the function does is write a document using fields from the form. Here's my function:

    function Make() {
    my = window.document;
    Client = my.menuPlanner.Client.value
    Cook_Date = my.menuPlanner.Cook_Date.value
    Cook_Time = my.menuPlanner.Cook_Time.value
    Service = my.menuPlanner.Service.value
    Chef = my.menuPlanner.Chef.value
    Notes = my.menuPlanner.Notes.value
    Monday_Entree = my.menuPlanner.Monday_Entree.value
    Monday_Side = my.menuPlanner.Monday_Side.value
    Tuesday_Entree = my.menuPlanner.Tuesday_Entree.value
    Tuesday_Side = my.menuPlanner.Tuesday_Side.value
    Wednesday_Entree = my.menuPlanner.Wednesday_Entree.value
    Wednesday_Side = my.menuPlanner.Wednesday_Side.value
    Thursday_Entree = my.menuPlanner.Thursday_Entree.value
    Thursday_Side = my.menuPlanner.Thursday_Side.value
    Friday_Entree = my.menuPlanner.Friday_Entree.value
    Friday_Side = my.menuPlanner.Friday_Side.value
    my.write("<html><head><title>todaysmenu - your customized menu plan</title><link href='../main.css' rel='stylesheet'></head><body><center>");
    my.write("<p><table width='383'><tr><td colspan='2' align='right'><img src='../images/pic-logo_small.gif' width='383' height='150' alt='todaysmenu - personal in home chefs'></td></tr>");
    my.write("<tr><td colspan='2'><p><br>" + Client + ", here is your customized menu plan. Please look over what's here to make sure it's what you want. If you wish to make changes, click the Back button on your browser to return to the previous page. If the information is correct, please print this page for your records.<br><img src='../images/pixel-clear.gif' width='5' height='5'></td></tr>");
    my.write("<tr><td width='150' align='right' valign='top'>Your Cook Date:&nbsp;</td><td width='233' valign='top'>" + Cook_Date + "</td></tr>");
    my.write("<tr><td width='150' align='right' valign='top'>Your Cook Time:&nbsp;</td><td width='233' valign='top'>" + Cook_Time + "</td></tr>");
    my.write("<tr><td width='150' align='right' valign='top'>Your Personal Chef:&nbsp;</td><td width='233' valign='top'>" + Chef + "</td></tr>");
    my.write("<tr><td width='150' align='right' valign='top'>Your Service:&nbsp;</td><td width='233' valign='top'>" + Service + "</td></tr>");
    my.write("<tr><td width='150' align='right' valign='top'>Notes:&nbsp;</td><td width='233' valign='top'>" + Notes + "<p></td></tr>");
    my.write("<tr><td width='383' colspan='2' align='center'><b>Mondays</b><br>");
    my.write("Entr&#233;e: " + Monday_Entree + "<br>");
    my.write("Side Dish: " + Monday_Side + "<p>");
    my.write("Entr&#233;e: " + Tuesday_Entree + "<br>");
    my.write("Side Dish: " + Tuesday_Side + "<p>");
    my.write("Entr&#233;e: " + Wednesday_Entree + "<br>");
    my.write("Side Dish: " + Wednesday_Side + "<p>");
    my.write("Entr&#233;e: " + Thursday_Entree + "<br>");
    my.write("Side Dish: " + Thursday_Side + "<p>");
    my.write("Entr&#233;e: " + Friday_Entree + "<br>");
    my.write("Side Dish: " + Friday_Side + "<br><img src='../images/pixel-clear.gif' width='5' height='5'></td></tr>");
    my.write("<tr><td width='383' colspan='2' align='center'>Close Window</td></tr></table>");

    Sorry if my original message was unclear. I guess what I have on the site right now is a different problem from what I've written about. What I really want to do, ultimately, is get the page that comes up AFTER the user hits "Confirm & Print" to execute the MailForm.cgi script and send the data to recipient. For some reason, what I currently have doesn't send the data -- it does generate an e-mail, but none of the data is in it.

    Thanks for your help.


  4. #4
    Join Date
    Nov 2002

    A better question to ask...

    To be clear, the question I should be asking is, how do I do what I'm currently doing at www.todaysmenu.ca/plan/tester.htm, but have the window that pops up when you hit the "Confirm & Print" button open in a new window?


  5. #5
    Join Date
    Nov 2002
    In the Make() function of the confirmPrint javascript file you have the code my=window.document; try using my=window.open(); instead. This should open a new window.

    Hope it works.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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