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 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Sep 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    window.open clearing form....

    I have a page with a form on it and a button that opens a new window for them to verify the data. What happens is that when the window opens, the form gets cleared out. This is with FireFox (IE has issues too!) Now this code has actually work fine for several years, now all of a sudden it's an issue. Possibly browser update issues? Here's a VERY stripped down version that shows the problem:

    Code:
    <HTML>
    <HEAD>
    <TITLE>Test</TITLE>
    
    <script language="JavaScript" type="text/javascript">
    
    function Proc_Reg(frm)
    {
       window.open("","","status=1,menubar=1,resizable=1,scrollbars=1,width=900,height=800");
    }
    </script>
    </HEAD>
    
    <BODY>
    test
    <form name=RegForm >
    
    <TABLE>
    <TR><TD><font color = "RED">PLEASE MAKE SURE YOUR BROWSER'S SECURITY SETTINGS ALLOW SCRIPTS TO RUN.</font></TD></TR></TABLE>
    <BR><BR>
    <font size=7>BCU Festival Registration</font><BR><center>Event Date: September 11, 2011</center>
    <HR>
    <table>
    <tbody>
    <tr><td><FONT FACE="BRITANNIC BOLD" size=4>
    Name:</font></td><td>
    <input title="What is Your Name?" name="FullName" rows="1" size="45" type="text">
    </td></tr>
    </tbody></table>
    
    </form>
    
    <A HREF="" OnClick="javascript:Proc_Reg(RegForm);">Click</A>
    
    </BODY>
    </HTML>
    Ideas???

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    26,536
    Thanks
    80
    Thanked 4,490 Times in 4,454 Posts
    If you don't suppress the natural action of any <a> link, then it *will* go ahead and load a new page, using the href, when clicked on.

    Answer is easy:
    Code:
    <a href="#" onclick="Proc_Reg(RegForm); return false;">Click</a>
    And isn't it time you moved to xhtml and all lower case tag names and properties?
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #3
    New to the CF scene
    Join Date
    Sep 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Old Pedant View Post
    If you don't suppress the natural action of any <a> link, then it *will* go ahead and load a new page, using the href, when clicked on.

    Answer is easy:
    Code:
    <a href="#" onclick="Proc_Reg(RegForm); return false;">Click</a>
    Finally got around to trying this. Your fix works great. Thanks

    Quote Originally Posted by Old Pedant View Post
    And isn't it time you moved to xhtml and all lower case tag names and properties?
    yeah....probably, you know...old dogs and all that...
    Thanks again


  •  

    Posting Permissions

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