SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    May 2005
    Posts
    93
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Javascript/Hidden Form Input Stomper

    Check this out. I have two test files. One called parent.html and the other called child.html. What the files do is open a pop-up window called child from parent. You can then plug some data into child, hit "send info" and the data the hidden form field should be populated. It's not working however. Here are the files

    parent.html

    Code:
    <html>
      <head>
        <title>Test</title>
        <script type="text/javascript">
          function OpenWindow(){
            var winPop = window.open("child.html","winPop");
          }
        </script>
      </head>
      <body>
        <form name="form1">
          <input type="hidden" name="text1" value="" id="text">
          <input type="button" name="button" value="Grab Info"  
    
    onclick="OpenWindow()">
        </form>
      </body>
    </html>
    Here is the child:

    Code:
    <html>
      <head>
        <title>Test</title>
        <script type="text/javascript">
          function SendInfo(){
            var txtVal = document.formPop.textPop.value;
            window.opener.document.form1.text1.value = txtVal;
            window.close();
          }
        </script>
      </head>
      <body>
        <form name="formPop">
          <input type="text" name="textPop">
          <input type="button" name="button" value="Send Info"  
    
    onclick="SendInfo()">
        </form>
      </body>
    </html>
    If i switch the input type to text it picks up the data. If I set it to hidden, it omits it. Any suggestions?

  2. #2
    SitePoint Enthusiast
    Join Date
    May 2005
    Posts
    93
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Does anyone know why this would happen? Can you change the value of a hidden field from a pop-up?

    _Din


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
  •