Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 11 of 11
  1. #1
    New Coder
    Join Date
    May 2005
    Location
    California
    Posts
    43
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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
    Senior Coder
    Join Date
    Sep 2005
    Posts
    1,791
    Thanks
    5
    Thanked 36 Times in 35 Posts
    <form name="cart" method="post" action="scriptname.cgi">
    <input type="submit" onclick="javascript:document.cart.submit();self.close();return false;">
    </form>

  • #3
    New Coder
    Join Date
    May 2005
    Location
    California
    Posts
    43
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i will try it right now!

  • #4
    Senior Coder
    Join Date
    Dec 2004
    Location
    Essex, UK
    Posts
    2,636
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You can use window.opener to target the window which opened the popup.

    Just a guess but something like the following could work.

    <input type="button" onclick="javascript:window.opener.cart.submit();self.close();return false;" />

  • #5
    New Coder
    Join Date
    May 2005
    Location
    California
    Posts
    43
    Thanks
    0
    Thanked 0 Times in 0 Posts
    mark, what is supposed to do the code you poste?

    thanks.

  • #6
    Senior Coder
    Join Date
    Dec 2004
    Location
    Essex, UK
    Posts
    2,636
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well the way I read your post...

    You have a form in a main window. The window also opens a popup which contains a picture and a button. When the button is pressed in the popup you want the form in the main window to submit and the popup closed?

    The code above is for the button in the popup.

  • #7
    New Coder
    Join Date
    May 2005
    Location
    California
    Posts
    43
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ok, let me install it and try it
    thanks again!

  • #8
    New Coder
    Join Date
    May 2005
    Location
    California
    Posts
    43
    Thanks
    0
    Thanked 0 Times in 0 Posts
    hi Mark... this is the code i tryied

    <form method=post action="http://order.store.yahoo.net/cgi-bin/wg-order?yhst-89+673"><input name=vwcatalog type=hidden value=yhst-16389103795725>
    <br>
    <font face=arial size=2>Qty:
    <input name=vwquantity value=1 maxlength=5 size=2>
    <input type=submit value="Order" onclick="javascript:window.opener.cart.submit();self.close();return false;"></b>
    </font>
    <input type=hidden name=.autodone value="http://company.com/673.html"> </form>

    ot works fine... it send the imput value and then close the pop window and then go to the opener page.... the thing is that that code dont imput the value "input name=vwquantity", it should imput to the form the desired quantity and it is only imputing the default value of 1.... any idea?
    thanks in advance!

    ALDO

  • #9
    Senior Coder
    Join Date
    Dec 2004
    Location
    Essex, UK
    Posts
    2,636
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Try this

    Code:
    <form method=post action="http://order.store.yahoo.net/cgi-bin/wg-order?yhst-89+673" onsubmit="javascript:window.opener.cart.submit();self.close();return false;"><input name=vwcatalog type=hidden value=yhst-16389103795725>
    <br>
    <font face=arial size=2>Qty:
    <input name=vwquantity value=1 maxlength=5 size=2>
    <input type=submit value="Order"></b>
    </font>
    <input type=hidden name=.autodone value="http://company.com/673.html"> </form>

  • #10
    New Coder
    Join Date
    May 2005
    Location
    California
    Posts
    43
    Thanks
    0
    Thanked 0 Times in 0 Posts
    hi Mark... the code is doing fine, but the thing is:
    - in firefox: It is posting the quantity value, as well the submit button, but the page is opened in the pop window, not in the opener window.
    - in i.e: it is returning to the opener window after submit, so fine!, but it isnt posting the quantity value.

    do you think that code is working for certain browser only?

    thanks again!

  • #11
    New Coder
    Join Date
    May 2005
    Location
    California
    Posts
    43
    Thanks
    0
    Thanked 0 Times in 0 Posts
    hi, do you think that the "window.opener.cart" can be bad working in firefox since that window is not opened by a regular window.open(), instead of it, its is opened by a custom javascript called Copener(pictureURL); that way that function make an blank open.window, then writes html, instead of opening an existing html page.

    I tested it openig the window with the regular open.window procedure and it make no diference... i think the problem is that the form is not passing the desired quantity value to the opener window....
    would be prety hard to accomplish?
    thanks
    Last edited by sugar2; 01-13-2006 at 01:02 AM.


  •  

    Posting Permissions

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