Results 1 to 2 of 2
  1. #1
    carag is offline Member
    Join Date
    Jul 2009
    Posts
    4
    Rep Power
    0

    Default Submit values to a parent page

    I have a code to submit values from child page to the parent page but some of the inputs I take values from are conditional or repeat - defined by php and the values are not transferred. Please help, this is my code (the relevant bits):

    Java Code:
    <head>
    
    <script langauge="javascript"> 
    function post_value(){ 
        opener.document.new_item.new_supplier_id.value = document.product.supplier_id.value;
        var contactElement = document.getElementById("suplier2_id");
        if (contactElement != null)
          {	
          opener.document.new_item.new_supplier2_id.value = document.product.supplier2_id.value;
          }
        var contactElement = document.getElementById("suplier_contact");
        if (contactElement != null)
          {	
          opener.document.new_item.new_supplier_contact.value = document.product.supplier_contact.value;
          }
        var contactElement = document.getElementById("suplier2_contact");
        if (contactElement != null)
          {	
          opener.document.new_item.new_supplier2_contact.value = document.product.supplier2_contact.value;
          }
        opener.document.new_item.new_product_code.value = document.product.code.value; 
        opener.document.new_item.new_product_name.value = document.product.name.value; 
        self.close(); 
    } 
    </script>
    
    </head
    
    <body>
    
      <form id="product" name="product" method="post" action="" style="margin-top:0; margin-bottom:0">
    
        <input name="supplier_id" type="radio" value="<?php echo $supplier_id; ?>" />
        <?php if ($supplier2_id) { ?><input name="supplier2_id" id="supplier2_id" type="text" value="<?php echo supplier2_id; ?>" /><?php } ?>
          
        <?php 
        if ($row_rsContacts['ContactID']) { 
          do { ?>
            <input name="supplier_contact" id="supplier_contact" type="radio" value="<?php echo ucwords($row_rsContacts['SupplierContactName']); ?>" />
          <?php 
          } while ($row_rsContacts = mysql_fetch_assoc($rsContacts));
        }
        ?>
    
        <?php 
        if ($supplier2_id) {
          if ($row_rsContacts2['ContactID']) { 
            do { ?>
              <input name="supplier2_contact" id="supplier2_contact" type="radio" value="<?php echo ucwords($row_rsContacts2['SupplierContactName']); ?>" />
            <?php 
            } while ($row_rsContacts2 = mysql_fetch_assoc($rsContacts2));
          }
        }
        ?>
    
        <input name="code" type="hidden" value="<?php echo $row_rsProducts['ProductID']; ?>" />
        <input name="name" type="hidden" value="<?php echo $row_rsProducts['ProductName']; ?>" />
        <input type="button" value="Add Product" onclick="post_value();" />
    
      </form>
    
    </body>
    Only the following are transferred: code and name.

    I will really appreciate your help.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    You'd best ask this question in a JavaScript forum as it will offer your best chances of getting a timely and correct answer. This is a Java forum. Best of luck.

    edit: heck, you've been told this before: need to adjust a code I have to work with hidden fields.

    Closing this thread.

Similar Threads

  1. Replies: 10
    Last Post: 08-12-2009, 04:02 PM
  2. posting results back to parent page
    By carag in forum New To Java
    Replies: 0
    Last Post: 07-29-2009, 12:29 PM
  3. to retrieve multiple values from html page through jsp
    By raghu9198 in forum JavaServer Pages (JSP) and JSTL
    Replies: 2
    Last Post: 02-17-2009, 02:43 PM
  4. Display success message in same page when submit button is clicked
    By am17mu in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 03-29-2008, 10:56 AM

Tags for this Thread

Posting Permissions

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