Click to See Complete Forum and Search --> : Window open after validation


Sandra
08-08-2003, 07:23 AM
Hi,

I'm struggling with this problem for hours and hope that someone can help me out.

I have created a small form on my homepage where you can submit name and e-mail.
The data is first validated (via javascript on my homepage) and then stored using a php page (send.php).

This send.php should produce a message in a new window where it thanks the person for submitting.
The question is how can I use the javascript window_open()
if I cannot put it right after "onsubmit".

My code looks something like this:

<SCRIPT LANGUAGE=javascript>
<!--
function validation()
(validates the form fields and return true if ok)
//-->
</SCRIPT>

In my form I have:
<form name="myform" method="post" action="send.php" onsubmit="return validation()">

So the question: how do I open send.php in a new window after validation.

Thanks !

Sandra.

pyro
08-08-2003, 07:35 AM
Add target="_blank" to the form tag. Note that the target attribute has been depreciated, however, so you'll have to use the transitional doctype.

Sandra
08-08-2003, 08:30 AM
Sorry, but I don't fully understand that.
Apart from opening the window I needed the window.open function also to control the window itself (scrollbars etc).
How do I do that with target="_blank".

Besides that I also didn't quite get this part of the answer:

" the target attribute has been depreciated, however, so you'll have to use the transitional doctype"....

Sandra.

Charles
08-08-2003, 10:11 AM
You need to do three things.

1) Add window.open('', 'child', 'height=400,width=300') to the end of you validation script, but before you return true.

2) Add target="child" to the start tag for your FORM element.

3) Use a transitional DOCTYPE.