Connecting Tech Pros Worldwide Forums | Help | Site Map

submit form values with openWindow

Martin Nadoll
Guest
 
Posts: n/a
#1: Jul 20 '05
Hello

i have a form, where my users can choose a postal code and a city to see a
table result page with only entries of their choice.

this results have to be shown in a new window :

var firstLink = unescape(firstURL.cfm');
var secondLink = unescape(secondURL.cfm');
var thirdLink = unescape(thirdURL.cfm');

var myFormLink = unescape(formresultURL.cfm');

function popUpWindow(URLStr, left, top, width, height)
{
if(popUpWin)
{
if(!popUpWin.closed) popUpWin.close();
}
popUpWin = open(URLStr, 'popUpWin',
'toolbar=no,location=no,directories=no,status=no,m enub
ar=no,scrollbars,resizable=no,copyhistory=yes,widt h='+width+',height='+heigh
t+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

html:

<A HREF="firstLink" onClick="popUpWindow(firstLink, 40, 42, 790, 450);
return false">here my first link</A>
<A HREF="secondLink" onClick="popUpWindow(secondLink, 40, 42, 790, 450);
return false">here my second link</A>
<A HREF="thirdLink" onClick="popUpWindow(thirdLink, 40, 42, 790, 450);
return false">here my third link</A>

Now the problem:
<form name="Firmenliste" method="post" action="Schnellsuche"
onSubmit="popUpWindow(myFormLink, 20, 20, 750, 400); return false">
<input name="any1" type="text" id="any1">
<input name="any2" type="text" id="any2">
<input name="Submit" type="submit" id="Submit" value="OK">
</form>

This opens formresultURL.cfm in a new window, as expected, but the new
window didn't receive the values of any1 and any2...

Any idea, how i can solve that problem?

Thanks a lot for any help and sorry for that long description of my problem,
but i want to make it as clear as possible.

Martin Nadoll



Guido Wesdorp
Guest
 
Posts: n/a
#2: Jul 20 '05

re: submit form values with openWindow


Martin Nadoll wrote:
[color=blue]
> <form name="Firmenliste" method="post" action="Schnellsuche"
> onSubmit="popUpWindow(myFormLink, 20, 20, 750, 400); return false">
> <input name="any1" type="text" id="any1">
> <input name="any2" type="text" id="any2">
> <input name="Submit" type="submit" id="Submit" value="OK">
> </form>
>[/color]
window.open can not be used as the action for a form, to solve this you
can either use 'target="_blank"' on the form tag to open a new window on
form submit (should work afaik) or add the key/value pairs to the URL as
'GET' vars: 'http://foo.com/mydoc.html?foo=bar&bar=baz' will send
'foo=bar' and 'bar=baz' to mydoc.html. Take care of encoding chars
whenever necessary using the escape function...

Cheers,

Guido

Michael Winter
Guest
 
Posts: n/a
#3: Jul 20 '05

re: submit form values with openWindow


Martin Nadoll wrote on 24 Nov 2003:

<snip>
[color=blue]
> popUpWin = open(URLStr, 'popUpWin',
> 'toolbar=no,location=no,directories=no,status=no,m enub
> ar=no,scrollbars,resizable=no,copyhistory=yes,widt h='+width+',hei
> ght='+heigh t+',left='+left+',
> top='+top+',screenX='+left+',screenY='+top+'');
> }[/color]

It would have been nice if you split that string into concatenated
sections, rather than letting it wrap - it would have been easier to
test.

<snip>
[color=blue]
> <form name="Firmenliste" method="post" action="Schnellsuche"
> onSubmit="popUpWindow(myFormLink, 20, 20, 750, 400); return
> false">[/color]

Your onsubmit event handler unconditionally cancels the submission.
The 'successful controls' won't be submitted unless you allow it,
whether that be through a call to Form.submit(), or returning true.

I think that using a pop-up and the 'post' method would be quite
difficult, and using 'get' might be a better alternative (depending
on the content of the submission). An alternative would be to use a
redirection page that opens in the current window, opens a pop-up
with the results, then takes the main window back to the form, or
another destination.

Mike

--
Michael Winter
M.Winter@blueyonder.co.uk.invalid (remove ".invalid" to reply)
Michael Winter
Guest
 
Posts: n/a
#4: Jul 20 '05

re: submit form values with openWindow


[This may result in a double post. Apologies if so.]

Martin Nadoll wrote on 24 Nov 2003:

<snip>
[color=blue]
> popUpWin = open(URLStr, 'popUpWin',
> 'toolbar=no,location=no,directories=no,status=no,m enub
> ar=no,scrollbars,resizable=no,copyhistory=yes,widt h='+width+',hei
> ght='+heigh t+',left='+left+',
> top='+top+',screenX='+left+',screenY='+top+'');
> }[/color]

It would have been nice if you split that string into concatenated
sections, rather than letting it wrap - it would have been easier to
test.

<snip>
[color=blue]
> <form name="Firmenliste" method="post" action="Schnellsuche"
> onSubmit="popUpWindow(myFormLink, 20, 20, 750, 400); return
> false">[/color]

Your onsubmit event handler unconditionally cancels the submission.
The 'successful controls' won't be submitted unless you allow it,
whether that be through a call to Form.submit(), or returning true.

I think that using a pop-up and the 'post' method would be quite
difficult, and using 'get' might be a better alternative (depending
on the content of the submission). An alternative would be to use a
redirection page that opens in the current window, opens a pop-up
with the results, then takes the main window back to the form, or
another destination.

Mike

--
Michael Winter
M.Winter@blueyonder.co.uk.invalid (remove ".invalid" to reply)


--
Michael Winter
M.Winter@blueyonder.co.uk.invalid (remove ".invalid" to reply)
Closed Thread