469,353 Members | 2,221 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,353 developers. It's quick & easy.

Form HTML Submit in popup

I have a form that submit to the same page when double click on a product:
<form method="post" action="quotes.asp" name="form1"
onDblClick="javascript:formHandler()">
How can I submit the form in a popup window and another page using a html
link?
Following code doesn't work because of the nested apostrophes in the
javascript.

<a href="#"
onclick="window.open('javascript:document.form1.ac tion='savequote.asp';
document.form1.submit();','popup','width=150, height=100,top=' + topPos +
',left=' + leftPos);">Save Quote</a>

<script language="JavaScript">
var w = 400, h = 200;
if (document.all || document.layers) {
w = screen.availWidth;
h = screen.availHeight;
}
var popW = 200, popH = 150;
var leftPos = (w-popW)/2, topPos = (h-popH)/2;
</script>
Jul 23 '05 #1
2 13853
> How can I submit the form in a popup window and another page using a html
link?


You need to define the form in the following manner (note the target):

<form action="savequote.asp" target="popup" name="quote">
... form data ..
</form>

The link like this

<A HREF="javascript:saveQuote();">Save Quote</A>

And some script code

<SCRIPT LANGUAGE="JavaScript">

function saveQuote() {

// first open window with right target
popup = window.open("about:blank", "popup", "etc..");

// then submit form into this window
document.quote.submit();
}
</SCRIPT>

That should work.

Jul 23 '05 #2
Vincent van Beveren wrote:
> How can I submit the form in a popup window and another page using a html
> link?


You need to define the form in the following manner (note the target):

<form action="savequote.asp" target="popup" name="quote">
... form data ..
</form>

The link like this

<A HREF="javascript:saveQuote();">Save Quote</A>


And then read this:
http://www.jibbering.com/faq/#FAQ4_24
And some script code

<SCRIPT LANGUAGE="JavaScript">
<script type="text/javascript">
function saveQuote() {

// first open window with right target
popup = window.open("about:blank", "popup", "etc..");

// then submit form into this window
document.quote.submit();
document.forms['quote'].submit();
}
</SCRIPT>

That should work.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/
Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Terence Parker | last post: by
3 posts views Thread by kirke | last post: by
11 posts views Thread by V S Rawat | last post: by
1 post views Thread by CARIGAR | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.