Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

submit a form from pop window, then close it... 1

Status
Not open for further replies.

sugarferret

IS-IT--Management
Jul 11, 2005
33
US
Hi, I have tried to accomplish this in the past with partially results only.
This is the background.
I have a page, this page have a submission form (a order button) submission and a little picture, if click the window for enlage it, i is wich opens a popup window containing the full picture and the same submission form (the same order button).
This popwindow should submit the form and then close itself.

I use this code... but it isnt passing the quantity to be ordered, it is passing only the submit action.

CODE:
<form method=post action=" onsubmit="javascript:window.opener.cart.submit();self.close();return false;">
<input name=vwcatalog type=hidden value=yhst-16103795725>
Qty: <input name=vwquantity value=1 maxlength=5 size=2>
<input type=submit value="Order">
<input type=hidden name=.autodone value="</form>


Any idea of how to accomplish this?

Thanks!
ALDO
 
Is there a quantity field on the page that calls the popup, or does the quantity field only exist on the popup itself? The reason the quantity field isn't being submitted with the popup is because the popup is never actually submitted. The onsubmit handler for the form in the popup calls submission from the parent window and then closes itself before it can be submitted. If you need the value from the quantity field to be submitted from the parent page, then you need to pass that value back to the parent page before the popup is closed. Assuming you have a textfield in your parent page called vwquantity the code will look something like this:

By the way, the "javascript:" is not needed in your onsubmit handler, it is implied
Code:
<form method=post action="[URL unfurl="true"]http://mysiter?yhst-16103795725+6731-wt"[/URL] onsubmit="[s]javascript:[/s][!]window.opener.cart.elements['vwquantity'].value = this.elements['vwquantity'].value; [/!]window.opener.cart.submit();self.close();return false;">

-kaht

How much you wanna make a bet I can throw a football over them mountains?
sheepico.jpg
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top