Yes, I can do the below but I was going to try to avoid having to use javascript to get the selected values and do the setting etc. Actually what I came up with works pretty well and others might want to use it. So here it is (for when you want to submit your form from a different link/button to a new window, but leave other submits submitting to the same window):
Not sure if this is the best approach but it seems to work. The key is assigning your current window.name to the target the form will normally submit to (so it doesn't open a new one). Then, on the cases where you want a new popup window you change the current window name then change it back. <script> window.name = "windowChoice"; //this has to match the form target name //called from some other link or button function iWantAPopUp() { window.name = "somethingElse"; form.dispatch.value='whatever'; popUp('about:blank', 'yes', 'windowChoice'); form.submit(); window.name = "windowChoice"; } function popUp(url, menuBar, windowName) { if ( !menuBar ) { menuBar = "yes"; } if ( !windowName ) { windowName = "popup"; } var pop = window.open(url, windowName, 'width=750,height=600,status=yes,menubar='+menuBar+',resizable=yes,scrollbars=yes'); pop.focus(); } </script> <html:form action="notificationAction" target="windowChoice"> On 6/15/06, Saul Qunming Yuan <[EMAIL PROTECTED]> wrote:
Can you do it in Javascript? something like the following: Parent window: <input type="button" name="preview" value="preview distribution" onclick="openPopup();" > Popup window <script language="javascript"> // getting multiple selected values from opener // set selected values (will be a list) to hidden form field // document.forms[0].multiSel1.value= setTimeout(submitForm, 1000); submitForm() { document.forms[0].submit; } </script> <form action="previewAction" method="post"> <input type="hidden" name="multiSel1" value=""> <input type="hidden" name="multiSel2" value=""> <input type="submit" name="go" value="Submit"> </form> Hope it'll work, Saul ----- Original Message ----- From: "Rick Reumann" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <user@struts.apache.org> Sent: Thursday, June 15, 2006 12:42 PM Subject: Advice on hanlding multi-select options that need a regular submit on form, plus a submit to popup window > I'm looking for advice on how to best handle this situation. > > I have a form with several multi-select drop downs. There is a typical > submit button that submits the form. What I also have is another > button within the form called "preview distribution" which needs to > take the data on the form and up processing it and displaying it on a > popup window. > > If it were just a few regular params i'd just create url link and pass > in through javascript the params as a get request. In this case, since > there are several multi select options, it would seem easier to submit > the whole form but in this case the target would need to change for > the form (and then would also have to change back so that the regular > submit works). > > I'll google around, but if anyone has some code to share that does > something like the above, I'd love to see it (Or possibly another work > around that doesn't involve rewriting the form's target property). > > Thanks, > > -- > Rick > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -------------------------------- > Spam/Virus scanning by CanIt Pro > > For more information see > http://www.kgbinternet.com/SpamFilter.htm > > To control your spam filter, log in at > http://filter.kgbinternet.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- Rick --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]