Open report in another tab

Asked

Viewed 979 times

0

I need the report, when the user clicks a button, to run in another tab. I am 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 selects a store, then I display a message pro user and does not generate the report , only the program opens it in a new tab. I need q it just open the report in new tab, the messages no. How to fix this?

It follows code from the store :

 <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>

follows code of the 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> 

1 answer

0


Try replacing:

onclick="target = '_blank'"

For:

target = "_blank"
  • he does the same thing, whether or not he performs the report he opens another page bringing my validations

  • Well, then I think it’s best if you do the two validations (store and date selected) in javascript/jquery, so you don’t even need to send form to validate. You could post the codes for the fields you need to validate?

  • I added the dates and the store thanks since

  • Bro from heaven, I know html and java, but I’ve never used Java. How do these 3 blocks of code look when the page loads in the browser? Show me this and I’ll make you the script to validate in javascript/jquery.

  • rsrs, explain not understood what I wanted to ask , you want to see my manager generate report ??

  • You posted the code that is in the file, I want to see those same elements after the html is generated, the code that appears in the browser. Do you have this page online? Or just open it in your browser, save the page as html and then copy the code saved here.

  • t on the air only for customers, has q have user and password to access

  • Then save the page (with CTRL+S) of the browser and paste here the part of the store and date elements.

Show 3 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.