/    Sign up×
Community /Pin to ProfileBookmark

javascript and forms

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,scrollbars=no,status=no,toolbar=no,resizable=no,left=50,top=50,screenX=50,screenY=50′);return false” action=”<?php echo”$PHP_SELF” ?>”>

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@gil_davisJan 14.2003 — 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.
Copy linkTweet thisAlerts:
@CharlesJan 14.2003 — [font=monospace]<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" ?>">[/font]

[font=georgia]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".[/font]
Copy linkTweet thisAlerts:
@Dan_DrillichJan 14.2003 — Charles,

It works!

BTW, why when I submit the new form (in the new small window) nothing happens?

Thanks,

Dan
Copy linkTweet thisAlerts:
@CharlesJan 14.2003 — [font=georgia]The [font=monospace]open[/font] method of a [font=monospace]window[/font] 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.[/font]
×

Success!

Help @tenaciousdave 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,
)...