my dog learned polymorphism
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

JavaRanch » Java Forums » Frameworks » Struts
Bookmark "submitting 1 form but 2 targets " Watch "submitting 1 form but 2 targets " New topic

submitting 1 form but 2 targets

nitin singh

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="" 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="<bean:writename="BusinessObjectActionForm" property="documentName"></bean:write>";
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.

Consultant, Sima Solutions
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: submitting 1 form but 2 targets
It's not a secret anymore!