I have a h:commandButton with an atribute onclick="this.form.target='_blank'" for open a PDF in new tab and it works perfectly, but after this action, all other actions (h:commandLink or h:commnadButton) without target attribute open in new tab too.
fragmat from xhtml file
<h:form>
<rich:panel header="User Logs Data">
<h:panelGrid id="ad" columns="2" columnClasses="fieldlabel,fieldvalue">
<h:outputText value=" Branch:" />
<h:selectOneMenu value="#{userLogsInformationController.branch}"
converter="#{bankBranchConverter}"
disabled="#{not sec:areAllGranted('SHOW_ALL_OUTWARD')}"
onchange="submit()"
valueChangeListener="#{userLogsInformationController.handleBranchChange}"
style="width : 250px;">
<f:selectItem itemLabel="[Select Branch]"/>
<f:selectItems value="#{userLogsInformationController.branches}"
var="br" itemLabel="#{br.name}"/>
</h:selectOneMenu>
</h:panelGrid>
<h:panelGrid columns="2">
<h:commandButton value="Report">
<f:ajax event="click" execute="@form" listener="#{userLogsInformationController.showReport}" render="@form" />
</h:commandButton>
<h:commandButton value="Download"
actionListener="#{userLogsInformationController.downloadReport}"
onclick="this.form.target='_blank'" ajax = "false"
disabled="#{userLogsInformationController.notAbleToPrint}"/>
<rich:messages id="messages" style="padding-left:40px; margin-top: 5px"/>
</h:panelGrid>
</rich:panel>
</h:form>
I have researched some issues and found that for the first time, target equals _blank it's added to the form as attribute. Second time, target="_blank" is still present in form, while it shouldn't (target parameter is undefined at this point).
I am not getting the solution and cant able to add the method in the page. Need some guide on how to fix this issue.