On 7/11/05, David Johnson <[EMAIL PROTECTED]> wrote: > Hi all > I have the following problem: > I have a button on my form that uses javascript to change to form target > before submitting because I'm exporting an RTF generated in my action to the > new browser, as follows > > <html:submit property="exportFlag" > onclick="set('export');setFormTarget('_export')" > disabled="false">Create Graph (Popup)</html:submit> > > function setFormTarget(newTarget){ > document.forms[0].target=newTarget; > } > > The thing is I want to be able to use the validate() method in my Form > object and return to the ORIGINAL browser if an error is encountered... > > so is there anything I can do within the action to affect that? > > Thanks
I never done stuff with popup windows, but I would consider trying something like this: * you open a new window and submit to action which validates input (automatic validation is turned off); * you manually call validate() from action class, and if input is incorrect, you return a small html with javascript, which would close current window (which is a popup), and would redirect to main window. The downside: would not work without javascript. The location of main window should be set either in struts-config.xml or maybe passed as parameter or maybe found out via referer... Also, to show errors after redirect you would have to stick them into session beforehand. Or to append to redirected request. * if data is ok, you respond with pdf to popup window directly or forward/redirect to action which responds with pdf. As a side note, I personally don't like apps which open windows themselves. I prefer to use "Open in a new window" option if I need it in a new window. Michael. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]