Open report in another tab

0

I need the report, at the time the user clicks a button, run on another tab. I'm using:

<p:commandButton  oncomplete="history.go(0)"   onclick="target = '_blank'"
  style="width: 200px;margin-top: 18px;float: right" type="submit" 
  value="Visualizar Relatório" ajax="false" update="form" actionListener="#
  {mbean_458_VendasGeral.gerarRelatorio('0')}">

It even works, the problem is when the user does not put a date or select a store, then I display a message to the user and does not generate the report, but the program opens this in a new tab. I need it to just open the report in new tab, the messages will not. How do I fix this?

Follow the store code:

 <div class="Container20 Responsive50" style="margin-left: 2px;">
                <div class="ContainerIndent">
                    <p:outputLabel style="#{mbean_458_VendasGeral.cor};margin-left: 5px;" value="Lojas"  />
                    <p:panelGrid id="t" columns="1" layout="grid" style="border:0px !important; background:none;" styleClass="ui-panelgrid-blank">
                        <p:selectCheckboxMenu filter="true" filterMatchMode="contains"  widgetVar="someVarName" id="lojas" label="#{mbean_458_VendasGeral.selectLj}"  value="#{mbean_458_VendasGeral.loja}"  >
                            <f:selectItems  var="loja" itemValue="#{loja.codloj}" itemLabel="#{loja.codloj}" value="#{mbean_458_VendasGeral.lojas}"/>
                            <p:ajax oncomplete="PF('someVarName').show()"  update="t" listener="#{mbean_458_VendasGeral.selectLoja()}" /> 
                            <p:ajax event="toggleSelect" oncomplete="PF('someVarName').show()" listener="#{mbean_458_VendasGeral.selectLoja()}" update="t"/>

                        </p:selectCheckboxMenu>
                    </p:panelGrid>
                </div>
            </div>

follow code for dates:

<div class="Container35 Responsive50">
                <div class="ContainerIndent">
                    <p:outputLabel style="margin-left: 5px;#{mbean_458_VendasGeral.cor}" value="Período de Vendas" />
                    <p:panelGrid columns="2" layout="grid" style="border:0px !important; background:none;" styleClass="ui-panelgrid-blank">
                        <p:calendar locale="pt_BR" onkeyup="Formatadata(this, event)" id="iniven" placeholder="Até" value="#{mbean_458_VendasGeral.iniven}" showOn="button" />

                        <p:calendar locale="pt_BR" onkeyup="Formatadata(this, event)" id="inifin" placeholder="Até" value="#{mbean_458_VendasGeral.finven}" showOn="button"/>
                    </p:panelGrid>
                </div>
            </div> 
    
asked by anonymous 31.03.2016 / 13:55

1 answer

0

Try replacing:

onclick="target = '_blank'"

By:

target = "_blank"
    
31.03.2016 / 15:34