Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Jun 2004
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question problem popup form

    I've got a great popup window for my form but it can't handle a hidden value. What do I change in the code below to make my hidden country field appear on the main window?

    Code:
    <html>
    <head>
    	<title>U.S. Address</title>
    <script language="Javascript" type="text/javascript">
    <!-- hide script from old browsers
    function updateParent1(textField){
    opener.document.contactinfo.address.value=textField.value
    }
    function updateParent2(textField){
    opener.document.contactinfo.city.value=textField.value
    }
    function updateParent3(textField){
    opener.document.contactinfo.state.value=textField.value
    }
    function updateParent4(textField){
    opener.document.contactinfo.zip.value=textField.value
    }
    function updateParent5(textField){
    opener.document.contactinfo.country.value=textField.value
    }
    // end hiding -->
    </script>
    </head>
    
    <body>
    <form action="none" onSubmit="window.close()">
    address: <input type="text" onblur="updateParent1(this)"><br>
    city: <input type="text" onblur="updateParent2(this)"><br>
    state: <input type="text" size="2" maxlength="2" onblur="updateParent3(this)"> zip: <input type="text" onblur="updateParent4(this)"><br>
    country: USA<br><br>
    <input type="hidden" value="USA" onblur="updateParent5(this)">
    <input type="submit" name="submit">
    </form>
    
    </body>
    </html>

  • #2
    New Coder
    Join Date
    May 2004
    Posts
    72
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Im only a newbie with JS so im probably miles of the mark here, but it appears none of your <INPUT> tags have names. Could that be the problem?
    "The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect."

    --Tim Berners-Lee, W3C Director and Inventor of the World Wide Web

  • #3
    New Coder
    Join Date
    Jun 2004
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It may be an odd script I'm trying to modify but the lack of names isn't a problem. The fields on the parent page have names so it all works out.

    My only problem is I can't drop a value into a field from a "hidden" value.

  • #4
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,074
    Thanks
    0
    Thanked 256 Times in 252 Posts
    Obviously, you can't set focus to a hidden field so onblur event won't be fired.

    <input type="hidden" value="USA" onblur="updateParent5(this)">
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________


  •  

    Posting Permissions

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