aspose file tools*
The moose likes Struts and the fly likes submitting 1 form but 2 targets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "submitting 1 form but 2 targets " Watch "submitting 1 form but 2 targets " New topic
Author

submitting 1 form but 2 targets

nitin singh
Greenhorn

Joined: Nov 07, 2006
Posts: 22
Hi I have a situation like.I have a form and 2 buttons.Onclick of first button the form should get submitted and result should come in same page.On the click of other button the form should get submitted but the result page should come in a new popup,parent window still open.
Any solution

<html:form action="fetchReportXls.do" method="post" target="_new">
I say this a new window comes.

for other button I call this but this will not work.Any suggestions ?

function viewForm(){
document.forms[0].action="fetchReport.do?document=<bean:writename="BusinessObjectActionForm" property="documentName"></bean:write>";
document.forms[0].submit();
}
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
You can manipulate the target with JavaScript. My advice would be to code the <html:form> tag without a target attribute and then put the logic to change the target in your JavaScript code.

For example, the JavaScript code:

document.forms[0].target = "_blank";

will cause the next form to be displayed in a new window while

document.forms[0].target = "_self";

will cause it to be displayed in the same window.


Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: submitting 1 form but 2 targets