Click to See Complete Forum and Search --> : javascript and forms
tenaciousdave
01-14-2003, 06:08 AM
HI, I'm having difficulty, i want to do up a form so when the submit button is clicked, rather than getting the next page in just a new window or the same page it opens in a smaller pop-up window. I've pasted the code as it currently stands, couple someone let me know how to combine the form action with the javascript.
<form method="post" onClick="window.open('windowname','action','width=150,height=100,directories=no,location=no,menubar=no,scroll bars=no,status=no,toolbar=no,resizable=no,left=50,top=50,screenX=50,screenY=50');return false" action="<?php echo"$PHP_SELF" ?>">
gil davis
01-14-2003, 06:14 AM
I think you want to use onSubmit to open the new window.
I also think your window.open is not going to do what you think it will. As it stands now, it would open a window called "action" and try to load a file called "windowname".
Since I don't know what that string in the action part of the form tag means, I'll leave that to someone else.
Charles
01-14-2003, 06:14 AM
<form method="post" onsubmit="window. open('','child','width=150,height=100,left=50,top=50,screenX=50,screenY=50')" target="child" action="<?php echo"$PHP_SELF" ?>">
The idea is to open an empty window just before the page is submitted and then to target the submission to that window. By the way, if you specify any of the window geometry, the other properties default to "no".
Dan Drillich
01-14-2003, 10:45 AM
Charles,
It works!
BTW, why when I submit the new form (in the new small window) nothing happens?
Thanks,
Dan
Charles
01-14-2003, 12:20 PM
The open method of a window object will open a new window with a given name only if a window with that name doesn't exist. In your case it does. The form is being submitted, but because it submits to itself and gets loaded in the same window, you cannot tell.