This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

submitting 1 form but 2 targets

 
nitin singh
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic