#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2000
    Posts
    25
    Rep Power
    0
    I'm writing a form - user clicks on a certain check box, which launches a pop-up windows asking for more information. They click the button, the window closes and the new information is passed back to the parent form. So far so good...

    My problem is that in passing that info, it also re-loads the page, losing any input the user has made to that point. Since this form has 8-10 text boxes, @18 check boxes, and a couple comment fields, this will not work. I've been humpin' this for a couple of days now and am not making any headway. I could really use some help on this. Thanks loads in advance (the code I'm using is below)


    [Initial page]
    -------------------------------------------
    <?
    if($submit)
    {
    echo "TBS=$tbs<br>";
    echo "Text1=$popText1<br>";
    echo "Text2=$popText2<br>";
    }
    ?>
    <?
    echo "Text1=$popText1<br>";
    echo "Text2=$popText2<br>";
    ?>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <script language="javascript">
    <!--
    var myPopup = '';
    var winl = (screen.width - 300) / 2;
    var wint = (screen.height - 300) / 2;
    document.write("width=300, top="+ wint +", left="+ winl);

    function hotWin() {
    if(document.mainForm.tbs.checked ==true)
    {
    myPopup = window.open("tbsPage.phtml","TBS_Info","width=300,height=300,top=" + wint + ",left=" + winl +",toolbar=0,location=0,menubar=0,scrollbars=0,resizable=0")
    myPopup.opener = self;
    }
    }
    // End -->
    </script>

    <html>
    <head>
    <title>Untitled</title>
    </head>
    <body>

    <form name="mainForm">
    Item 1
    <input type="checkbox" name="tbs" value="1" onClick="hotWin()")>

    <br>
    <br>

    <input type="submit" name="submit" value="Submit">
    </form>

    <FORM NAME="hiddenForm" ACTION="test.phtml">
    <input type="hidden" name="popText1">
    <input type="hidden" name="popText2">
    </FORM>

    </body>
    </html>

    [PopUp Page]
    --------------------------------------------
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
    <title>Untitled</title>

    <script language="javascript">
    <!--
    function copyForm() {
    opener.document.hiddenForm.popText1.value=document.popupForm.popText1.value;
    opener.document.hiddenForm.popText2.value=document.popupForm.popText2.value;
    opener.document.hiddenForm.submit();
    window.close();
    return false();
    }
    //-->
    </script>

    </head>

    <body>
    <form name="popupForm" onSubmit="return copyForm()";>
    <input type="text" name="popText1">
    <p>
    <input type="text" name="popText2">
    <br>
    <input type="button" name="submit" value="Submit" onClick="copyForm()">
    </form>
    </body>
    </html>

  2. #2
  3. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    6
    Rep Power
    0
    Well if i understand it correctly
    this is a javascript issue

    and removing the following line
    opener.document.hiddenForm.submit();
    from the popup window will prevent the original form
    from reloading, so all the input fields
    will be un-altered

    ------------------
    Greetings lewi

Similar Threads

  1. Replies: 5
    Last Post: February 2nd, 2005, 12:28 AM
  2. UTF-8 problem in 4.1.1a
    By mehran20 in forum MySQL Help
    Replies: 1
    Last Post: February 8th, 2004, 02:21 PM
  3. WinNT4 problem
    By sandipguha in forum Windows Help
    Replies: 0
    Last Post: January 27th, 2004, 02:06 AM
  4. weird java problem..please help
    By suwandy in forum Java Help
    Replies: 1
    Last Post: January 26th, 2004, 04:13 AM
  5. Session Variable problem :(
    By modesty in forum PHP Development
    Replies: 1
    Last Post: January 15th, 2004, 04:00 AM

IMN logo majestic logo threadwatch logo seochat tools logo