jeff
jeff

Reputation: 3742

JSF commandButtons both open separate window, but only one should

The following two command buttons both open a second browser, but I only have the onclick target _blank on the second button. The unexpected behavior appears by clicking the second View Report button and then clicking the first Update Chart:

<h:form>
  <h:commandButton value="Update Chart" action="#{commitment.loadChartData}" />&nbsp;
  <h:commandButton value="View Report" action="#{ccommitment.generateReport}" onclick="this.form.target='_blank'" />
</h:form>

Upvotes: 0

Views: 394

Answers (1)

partlov
partlov

Reputation: 14277

Well, if you click second button it will set target property of the form object. This property will stay _blank and it will be applied on the first button click. You can reset this property in onclick of first button.

Upvotes: 2

Related Questions