Results 1 to 4 of 4

Thread: Help with pop-up on form submit

  1. #1
    Join Date
    Nov 2009
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Help with pop-up on form submit

    Script: DHTML Window widget
    http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow/

    I am trying to use the DHTML Window widget with a form to pop window.
    I am trying to use the iframe example, but can not seem to get the code correct.
    The window pops but the variables do not post. Below is what I am using.

    This is the main page that calls the pop-up and sends the variables
    Code:
    <html>
    <head>
    <title>Order Processing System </title>
    <link rel="stylesheet" href="windowfiles/dhtmlwindow.css" type="text/css" />
    <script type="text/javascript" src="windowfiles/dhtmlwindow.js">
    /***********************************************
    * DHTML Window Widget-  Dynamic Drive (www.dynamicdrive.com)
    * This notice must stay intact for legal use.
    * Visit http://www.dynamicdrive.com/ for full source code
    ***********************************************/
    </script>
    <script>
    function popchangeaction(myForm) {
    var w = dhtmlwindow.open("changeaction", "iframe", "op-doad.php", "Change the action", "width=200px,height=200px,resize=1,scrolling=1,left=10px,top=10px");
    }
    </script>
    </head>
    <body>
    <?php
    $edit_time = date('M d Y g:iA', strtotime('now')); 
    $order_no = '987652';
    print "<table>
    <tr>
    <td>Order No</td>
    <td>action_code</td>
    </tr>";
    ?>
    <?php					
    print "	<tr>
    <td>$order_no</td>
    <td>
    <FORM target='_iframe-changeaction' action='op-doad.php' method='POST'><input type='hidden' value='$order_no' name='order_no'>
    <select type='submit' name='action_code' onchange='popchangeaction(this)'><option value='' selected>blank</option>
    <option value='selection1'>selection1</option>
    <option value='selection2'>selection2</option>
    </select>
    </font></td></tr></table></form>';
    ?> 
    </body>
    </html>
    This is the page that should be in the popup and receive the posted variables
    Code:
    <html>
    <head>
    <title>TITLE</title>
    </head>
    <body>
    <?php
    $edit_time = date('M d Y g:iA', strtotime('now')); 
    $order_no = $_POST['order_no'];
    $new_action_code = $_POST['action_code'];
    
    echo'Your order has been submitted for processing.<br />';
    
    echo'<br />';
    echo'edit_time';
    echo'<br />';
    echo $edit_time;
    echo'<br />';
    echo'order_no';
    echo'<br />';
    echo $order_no;
    echo'<br />';
    echo'action_code';
    echo'<br />';
    echo $new_action_code;
    echo'<br />';
    
    echo 'The database has been updated!';
    ?>
    
    </body>
    </html>
    Last edited by jaustill; 12-19-2009 at 06:54 PM. Reason: Fix [CODE] tags

  2. #2
    Join Date
    Nov 2009
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I may have solved my problem, I rewrote my onChange from
    this

    Code:
    onchange='popchangeaction(this)'
    to this

    Code:
    onChange='submit(popchangeaction(this))'
    It works perfect now, however I am a beginner coder.

    Did I do this correctly or is it a fluke that it works and will cause me problems with browsers other than Win IE.

  3. #3
    Join Date
    Aug 2004
    Posts
    10,140
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Are you trying to set up a form whereby when it's submitted, the results load in the DHTML Window? Generally for form submission there aren't that many cross browser issues, so if it works in Win IE, it should generally work in other browsers too. But we would need to see the code behind popchangeaction() to know if there are any issues.
    DD Admin

  4. #4
    Join Date
    Nov 2009
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Yes, I am trying to set up a form that when it's submitted, the results load in the DHTML Window.

    The only thing I changed from my first post was to put the DHTML widget call in the brackets after submit. I do not know if it was proper/correct to do that, I tried it and it just happened to work.

    This is ALL of the code for BOTH pages, nothing in the dhtml window widget files called from the directory windowfiles was touched.
    Code:
    onchange='popchangeaction(this)'
    to this
    Code:
    onChange='submit(popchangeaction(this))'
    Below is ALL of the code on both of my pages.

    The only other thing I would like to do is hide the widget after a few seconds instead of it staying on the screen.

    This is the main page that calls the pop-up and sends the variables
    Code:
    <html>
    <head>
    <title>Order Processing System </title>
    <link rel="stylesheet" href="windowfiles/dhtmlwindow.css" type="text/css" />
    <script type="text/javascript" src="windowfiles/dhtmlwindow.js">
    /***********************************************
    * DHTML Window Widget-  Dynamic Drive (www.dynamicdrive.com)
    * This notice must stay intact for legal use.
    * Visit http://www.dynamicdrive.com/ for full source code
    ***********************************************/
    </script>
    <script>
    function popchangeaction(myForm) {
    var w = dhtmlwindow.open("changeaction", "iframe", "op-doad.php", "Change the action", "width=200px,height=200px,resize=1,scrolling=1,left=10px,top=10px");
    }
    </script>
    </head>
    <body>
    <?php
    $edit_time = date('M d Y g:iA', strtotime('now')); 
    $order_no = '987652';
    print "<table>
    <tr>
    <td>Order No</td>
    <td>action_code</td>
    </tr>";
    ?>
    <?php					
    print "	<tr>
    <td>$order_no</td>
    <td>
    <FORM target='_iframe-changeaction' action='op-doad.php' method='POST'><input type='hidden' value='$order_no' name='order_no'>
    <select type='submit' name='action_code' onchange='popchangeaction(this)'><option value='' selected>blank</option>
    <option value='selection1'>selection1</option>
    <option value='selection2'>selection2</option>
    </select>
    </font></td></tr></table></form>';
    ?> 
    </body>
    </html>
    This is the page that is be in the popup and receives the posted variables
    Code:
    <html>
    <head>
    <title>TITLE</title>
    </head>
    <body>
    <?php
    $edit_time = date('M d Y g:iA', strtotime('now')); 
    $order_no = $_POST['order_no'];
    $new_action_code = $_POST['action_code'];
    
    echo'Your order has been submitted for processing.<br />';
    
    echo'<br />';
    echo'edit_time';
    echo'<br />';
    echo $edit_time;
    echo'<br />';
    echo'order_no';
    echo'<br />';
    echo $order_no;
    echo'<br />';
    echo'action_code';
    echo'<br />';
    echo $new_action_code;
    echo'<br />';
    
    echo 'The database has been updated!';
    ?>
    
    </body>
    </html>
    Last edited by jaustill; 12-20-2009 at 04:00 PM. Reason: spelling

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
  •