/    Sign up×
Community /Pin to ProfileBookmark

passing form variables to popup window

Hi, I am trying to pass form variables <form method=’post’ action=’ ‘ onsubmit=’openme()’> to a popup window defined in the head as such:
<script language=”Javascript”>
<!– Hide script from old browers
function openme()
{
var openup
openup=window.open(‘general_1.php’,’Sheet’,’width=300,height=400,directories=no,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=no,screenX=25,screenY=100,top=25,left=100′)
}
// End hiding
</script>

None of the variables created in my form are being passed to the receiving popup window, general_1.php. It is a simple page, with only phpinfo() function right now, and it is showing no variables being passed. Any help would be appreciated.

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@JonaNov 17.2003 — [font=arial]Do you have a form in the popup or in the parent?[/font]

[b][J]ona[/b]
Copy linkTweet thisAlerts:
@tomhiltonauthorNov 17.2003 — The form is in the parent, and I am wanting to pass it to the child popup. I created a workaround that works. I have the user verify the initial form by submitting it to subsequent page. This initializes my variables from the original form, allowing me to pass them through an onclick on the subsequent page as part of the url, to the popup.

I guess I was thinking that when you click the "submit" button in an html form, the form data passes to wherever the subsequent page is, but if you use javascript (ie send to popup), and you're not actually communicating with the server, this is not going to happen, correct? Or am I wrong about this? Just seems like data should be available, whether using javascript or html to get to another page.
Copy linkTweet thisAlerts:
@JonaNov 17.2003 — [font=arial]When a form's action is set to the javascript: protocol, it only executes JavaScript code--no interaction with the server is made. I'd use onsubmit rather than action for JavaScript, though, for users with JavaScript disabled. Have you solved your problem?[/font]

[b][J]ona[/b]
Copy linkTweet thisAlerts:
@tomhiltonauthorNov 18.2003 — I think I'm going to stick with my current solution, having the user submit the form first to set the form variables through the server, then a second submit form to verify their input that will use javascript to pass the now instantiated variables through the url get method to the popup. I tried using the "onsubmit" method on the first form, but that also did not pass the variables, but that seems to make sense based on what you've said. Thanks for your help, I really appreciate it!
Copy linkTweet thisAlerts:
@JonaNov 18.2003 — [font=arial]Glad I could help.[/font]

[b][J]ona[/b]
×

Success!

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