/    Sign up×
Community /Pin to ProfileBookmark

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.

    to post a comment
    HTML

    6 Comments(s)

    Copy linkTweet thisAlerts:
    @deraJan 04.2006 — i would use an absolute positioned div instead of a popup window you can stop them easily with popup blockers

    eg
    [code=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>
    Copy linkTweet thisAlerts:
    @sugar2authorJan 05.2006 — 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!
    Copy linkTweet thisAlerts:
    @sugar2authorJan 13.2006 — Dera, what is supposed to do the code you posted?

    thanks!
    Copy linkTweet thisAlerts:
    @CytaelJan 13.2006 — [code=html]<form name="cart" method="post" action="scriptname.cgi">
    <a href="javascript:document.cart.submit(); window.close();">Submit</a>
    </form>
    [/code]
    Copy linkTweet thisAlerts:
    @sugar2authorJan 13.2006 — thanks!
    Copy linkTweet thisAlerts:
    @sugar2authorJan 13.2006 — Thanks to all

    This code works for IE as for Firefox:

    <script>

    if (document.all)

    OrderScript = 'nt<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;">nt<input name=vwcatalog type=hidden value=103795725>nt<br>nt<font face=arial size=2>Qty: <input name=vwquantity value=1 maxlength=5 size=2>nt<input type=submit value="Order"></b></font>nt<input type=hidden name=.autodone value="http://a.com/6731-wt.html">nt</form>n ';

    else

    OrderScript = 'nt<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;">nt<input name=vwcatalog type=hidden value=103795725>nt<br>nt<font face=arial size=2>Qty:<input name=vwquantity value=1 maxlength=5 size=2>nt<input type=submit value="Order"></b></font>nt<input type=hidden name=.autodone value="http://a.com/6731-wt.html">nt</form>n ';

    </script>


    Thanks!
    ×

    Success!

    Help @sugar2 spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.24,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...