...

View Full Version : window.open clearing form....



aa9gg
09-01-2011, 02:28 PM
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:



<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???

Old Pedant
09-01-2011, 05:48 PM
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:


<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?

aa9gg
10-06-2011, 02:25 PM
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:


<a href="#" onclick="Proc_Reg(RegForm); return false;">Click</a>


Finally got around to trying this. Your fix works great. Thanks


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... :o
Thanks again



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum