/    Sign up×
Community /Pin to ProfileBookmark

Window open after validation

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.

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@pyroAug 08.2003 — 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.
Copy linkTweet thisAlerts:
@SandraauthorAug 08.2003 — 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.
Copy linkTweet thisAlerts:
@CharlesAug 08.2003 — [font=georgia]You need to do three things.

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

2) Add [font=monospace]target="child"[/font] to the start tag for your FORM element.

3) Use a transitional DOCTYPE.[/font]
×

Success!

Help @Sandra spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...