www.webdeveloper.com
Results 1 to 4 of 4

Thread: Using getElementById()

  1. #1
    Join Date
    Jan 2011
    Posts
    6

    Using getElementById()

    Hey gurus, I have a php form (form A) that when I click some button, it opens a popup window which is also a php page (form B). In the popup I enter some values and want to submit these values to form B.

    I have tried document.getElementById() method while at form A to read form B hidden value id but i dont get any results. Is it possible to achieve this? Please assist.

    Mutua

  2. #2
    Join Date
    Sep 2008
    Location
    Akron, OH
    Posts
    1,125
    If it's a "popup" window, then you won't be able to read the info from "form B" at "form A" unless you pass the information between each other. Do you have a link that demonstrates the scenario?

  3. #3
    Join Date
    Mar 2010
    Posts
    2,803
    or post the code you have so far and we can try to help you get it working

  4. #4
    Join Date
    Jan 2011
    Posts
    6
    cbVision and tirna

    I have pasted the codes here. regAssignUser.php opens a popup files.php and then files.php close() to end data to regAssignUser.php
    Code:
    =================================
    <!-- regAsignUser.php -->
    ====================================
    <?php session_start(); ?>
    
    <script type="text/javascript">
        function open_files()
        {
            var mySearch = document.getElementById("idFile");
            if(mySearch.value == ""){
                alert("You Have Not Entered Anything");
            }else{
            window.open('files.php?myList='+mySearch.value,'myExample','width=600,height=700,modal=yes, scrollbars=yes, location=no'); 
            }
        }
    </script>
    
    <script type="text/javascript">
        function readValue()
        {
            var XX = document.getElementById("myFileNoX");
            alert(XX.value);
        }
    </script>
    
    <?php
    .
    .
    .
    others codes goes down here
    
    ===========================================
    <!-- file.php -->
    ========================================
    <?php session_start(); ?>
    <html>
        <head>
        </head>
        <body>
            <?php  $txtFile = $_GET['myList'];  ?>
    
            <script type="text/javascript">
                function submitForm()
                {
                    document.forward.submit()
                    close();    
                }
            </script>
    
            <script type="text/javascript">
                function closeNull()
                {
                    close();
                }
            </script>
            <?php
            include_once('./Connections/myconn.php');
            $db = mysql_select_db('registryis', $myconn);
            if (!$db) {// if the database is not available
                $message = " There was a problem in trying to connect to the database.Please try later after sometime";
                mysql_error();
                exit;
            }
    
            $result = @mysql_query("select * from file where fileTitle like '&#37;$txtFile%' or fileNo like '%$txtFile%';");
            if (!$result) {
                exit('<p> Error performing query: ' . mysql_error() . '</p>');
            }
    
            $num = mysql_num_rows($result);
            if ($num == 0) {
            ?>
                <table width="75%" border="1" align="left" bgcolor="#CC99CC">
                    <tr>
                        <td><div align="center" class="style1">Your Search Found No File(s) <BR>
                        <input type=button onClick="closeNull()" value='Close Window'> </div> </td>
                    </tr>
                </table>
    
            <?php  } else {  ?>
    
                <table width="75%" border="1" align="center" bgcolor="#CC99CC" >
                    <FORM NAME="forward" ACTION="regAssignUser.php" />
                    <tr>
                        <td width="196"><strong>File Number</strong></td>
    
                    <?php do {  ?>
                        <td><?php echo $row_qry['fileNo']; ?> </td>
    
                    <?php $fileNo = $row_qry['fileNo'];  ?>
                    <input type="hidden" name="myFileNo" id="myFileNoX" value = <?php echo $fileNo; ?> />
                    <td><input type="radio" name="radSelect" value="Select" onClick ="submitForm()" /> </td>
    
                </tr>
            <?php } while ($row_qry = mysql_fetch_array($result)); } ?>
    
            </form>
        </table>
        </body>
        </html>
    Last edited by Kor; 02-02-2011 at 04:52 AM. Reason: Wrap the code [code][/code]

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



Recent Articles