Connecting Tech Pros Worldwide Help | Site Map

Form HTML Submit in popup

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 23rd, 2005, 11:24 AM
Johan
Guest
 
Posts: n/a
Default 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>



  #2  
Old July 23rd, 2005, 11:26 AM
Vincent van Beveren
Guest
 
Posts: n/a
Default 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.

  #3  
Old July 23rd, 2005, 11:26 AM
Randy Webb
Guest
 
Posts: n/a
Default 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/
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.