Click to See Complete Forum and Search --> : passing form variables to popup window


tomhilton
11-16-2003, 12:08 PM
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.

Jona
11-16-2003, 09:02 PM
Do you have a form in the popup or in the parent?

[J]ona

tomhilton
11-17-2003, 06:56 AM
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.

Jona
11-17-2003, 03:01 PM
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?

[J]ona

tomhilton
11-18-2003, 07:03 AM
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!

Jona
11-18-2003, 03:49 PM
Glad I could help.

[J]ona