Forum Moderators: open

Message Too Old, No Replies

Self closeable pop up window with submit button.

pop up window submit form javascript

         

sugar2

10:38 pm on Jan 3, 2006 (gmt 0)

10+ Year Member



Self closeable pop up window with submit button...

pop up window submit form javascript

Hi, I just launched in my site an addin, it is basically a order product button in a pop up picture window of the item.
So the customers can order the item from the pop up Picture window if dessired... the complicated thing for me is how to do this:

- To close that pop window after click the order button.
those are my first 2 attemps with no satisfactory results...

This first code closes the window and post nothing.
<form name="cart" method="post" action="scriptname.cgi">
<a href="javascript:document.cart.submit();" onClick="javascript:self.close();">Submit</a>
</form>

This 2nd code submit the thing but dont close the window.
<form onsubmit="javascript:self.close();" method=post action="scriptname.cgi">
<a href="javascript:document.cart.submit();" onsubmit="javascript:self.close();">Submit</a>
</form>

any idea with that mission?
thanks in advance.

tedster

3:38 pm on Jan 4, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



How about this?

<a href="javascript:document.cart.submit();self.close();">Submit</a>

DrDoc

5:31 pm on Jan 4, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The problem is still that
self.close()
will probably be executed before the form has submitted.

As I see it, there are two possibilities:

1) submit using the window opener as the target, which makes calling self.close the way tedster suggests completely safe
2) submit and return some HTML which then closes the window

sugar2

12:55 am on Jan 5, 2006 (gmt 0)

10+ Year Member



Actually it works with I.E., the thing is that the "Qty:" imput doesnt send nothing to the form submit...
And with Firefox it can send the imput Qty: to the submit form but it opens the submit link in a new window... no the callin window... i think its because firefox isnt registering the window.opener value i dont know why.

this is the ie code:

<form method=post action="http://order.store.domain.net/cgi-bin/wg-order?yhst-1638995+6731-wt" onsubmit="javascript:window.opener.cart.submit();self.close();return false;">
<input name=vwcatalog type=hidden value=yhst-16395725>
Qty: <input name=vwquantity value=1 maxlength=5 size=2>
<input type=submit value="Order">
<input type=hidden name=.autodone value="http://mysite.com/6731-wt.html">
</form>

any idea?

thanks!

DrDoc

6:15 am on Jan 5, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think what you want is set the target to the opener (which requires the original window/frame having a name).

sugar2

5:19 pm on Jan 5, 2006 (gmt 0)

10+ Year Member



that is what i want... do i have to insert all my opener page or opener link in a DIV?

thanks