By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,466 Members | 1,202 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,466 IT Pros & Developers. It's quick & easy.

submit form values with openWindow

P: n/a
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
Jul 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Martin Nadoll wrote:
<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>

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

Jul 20 '05 #2

P: n/a
Martin Nadoll wrote on 24 Nov 2003:

<snip>
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+'');
}
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>
<form name="Firmenliste" method="post" action="Schnellsuche"
onSubmit="popUpWindow(myFormLink, 20, 20, 750, 400); return
false">


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.******@blueyonder.co.uk.invalid (remove ".invalid" to reply)
Jul 20 '05 #3

P: n/a
[This may result in a double post. Apologies if so.]

Martin Nadoll wrote on 24 Nov 2003:

<snip>
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+'');
}
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>
<form name="Firmenliste" method="post" action="Schnellsuche"
onSubmit="popUpWindow(myFormLink, 20, 20, 750, 400); return
false">


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.******@blueyonder.co.uk.invalid (remove ".invalid" to reply)
--
Michael Winter
M.******@blueyonder.co.uk.invalid (remove ".invalid" to reply)
Jul 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.