www.webdeveloper.com
Results 1 to 7 of 7

Thread: Self closeable pop up window with submit button...

  1. #1
    Join Date
    May 2005
    Posts
    16

    Self closeable pop up window with submit button...

    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.

  2. #2
    Join Date
    Apr 2004
    Location
    Warning: main(location.php): failed open stream
    Posts
    1,119
    i would use an absolute positioned div instead of a popup window you can stop them easily with popup blockers
    eg
    [php]
    <div id="popup">
    content
    </div>

    form:
    <form name="cart" method="post" action="scriptname.cgi">
    <a href="javascript:document.cart.submit();" onClick="getelementbyid('popup").style.visibility=hidden;">Submit</a>
    </form>
    fabioDRN.com

  3. #3
    Join Date
    May 2005
    Posts
    16
    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!

  4. #4
    Join Date
    May 2005
    Posts
    16
    Dera, what is supposed to do the code you posted?

    thanks!

  5. #5
    Join Date
    Nov 2005
    Location
    The best country in the world, Texas!
    Posts
    251
    HTML Code:
    <form name="cart" method="post" action="scriptname.cgi">
    <a href="javascript:document.cart.submit(); window.close();">Submit</a>
    </form>
    WARNING: Use code provided at your own risk!

  6. #6
    Join Date
    May 2005
    Posts
    16
    thanks!

  7. #7
    Join Date
    May 2005
    Posts
    16
    Thanks to all
    This code works for IE as for Firefox:

    <script>
    if (document.all)
    OrderScript = '\n\t<form target=aldo method=post action="http://order.store.yahoo.net/cgi-bin/wg-order?103795725+6731-wt" onsubmit="javascript:submit();self.close();return false;">\n\t<input name=vwcatalog type=hidden value=103795725>\n\t<br>\n\t<font face=arial size=2>Qty: <input name=vwquantity value=1 maxlength=5 size=2>\n\t<input type=submit value="Order"></b></font>\n\t<input type=hidden name=.autodone value="http://a.com/6731-wt.html">\n\t</form>\n ';
    else
    OrderScript = '\n\t<form target=aldo method=post action="http://order.store.yahoo.net/cgi-bin/wg-order?103795725+6731-wt" onsubmit="javascript:submit();setTimeout(\'window.close()\',1000);return false;">\n\t<input name=vwcatalog type=hidden value=103795725>\n\t<br>\n\t<font face=arial size=2>Qty:<input name=vwquantity value=1 maxlength=5 size=2>\n\t<input type=submit value="Order"></b></font>\n\t<input type=hidden name=.autodone value="http://a.com/6731-wt.html">\n\t</form>\n ';
    </script>


    Thanks!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles