Connecting Tech Pros Worldwide Help | Site Map

Form HTML Submit in popup

Johan
Guest
 
Posts: n/a
#1: Jul 23 '05
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>


Vincent van Beveren
Guest
 
Posts: n/a
#2: Jul 23 '05

re: Form HTML Submit in popup


> How can I submit the form in a popup window and another page using a html[color=blue]
> link?[/color]

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.

Randy Webb
Guest
 
Posts: n/a
#3: Jul 23 '05

re: Form HTML Submit in popup


Vincent van Beveren wrote:[color=blue][color=green]
> > How can I submit the form in a popup window and another page using a[/color]
> html[color=green]
> > link?[/color]
>
> 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>[/color]

And then read this:
http://www.jibbering.com/faq/#FAQ4_24
[color=blue]
> And some script code
>
> <SCRIPT LANGUAGE="JavaScript">[/color]

<script type="text/javascript">
[color=blue]
> function saveQuote() {
>
> // first open window with right target
> popup = window.open("about:blank", "popup", "etc..");
>
> // then submit form into this window
> document.quote.submit();[/color]

document.forms['quote'].submit();
[color=blue]
> }
>
>
> </SCRIPT>
>
> That should work.
>[/color]


--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/
Closed Thread


Similar JavaScript / Ajax / DHTML bytes