Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
ok, heres what i need
you know the way you have a form, well when you click submit you can either have the form submit the details to new page in the same window, or to a new window using target=BLANK
well heres what i need
i want the form to submit to a new popup window, no file menu, address bar etc etc
how tho?
<form action=page.php target=(javascript:POPUP HERE)>
really need help on this 1

Just create your form tag as you would normally with a target to the name you will create to the popup window. But instead of a SUBMIT button, create a generic button with an onClick action to a JS function. The function will first create the popup window with the same name you specified in the form target, then it will submit the form.
You can copy the following and save it as "theForm.htm" to see an example.
<html>
<head>
<script>
function submitForm() {
window.open ("theForm.htm", "NewWindow","menubar=0,resizable=1,width=350,height=250");
document.myform.submit();
}
</script>
</head><body>
<form action="theForm.htm" name="myform" target="NewWindow">
<input type=text name=name>
<input type=button onClick="javascript:submitForm();" value="submit">
</form></body>
</html>

Very clever Michael - a lot cleaner than the way I was thinking of.
Jamie, just be aware that your page will be called twice, so make sure and check that there is POST data before doing anything.
-SN

It will be called twice...Once on window.open, the next when the form is submitted. When the button is clicked, the javascript opens a new window with the name "NewWindow" that opens "theForm.htm" - with no POST data. Then, right after the window is opened and the request is made for "theForm.htm", the Form submit hijacks this window - cancelling the first request and re-requesting theForm.htm with all the POST data from the form.
It doesn't have to be submitted twice...You could have the javascript open a blank html file, then the form's action would be your PHP. This would probably be your best bet.
-SN


![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |