I am supporting an old application. This is my first JSF project. I added a new upload functionality. In this page/screem already code was ther to search and download to Excel.
After I added upload functionality, the upload works as expected. But the existing functionality broken. That means when user does a filter/search and click on Export To Excel button, it shows error message that is inside requiredMessage="Select a file to upload..."
No clue why it is happening.
Code:
<p:fieldset id="uploadMonthlyActualVolumeFieldSet" style="width: 80%;height:100% !important" legend="Upload Monthly Data" >
<h:panelGrid columns="2" cellpadding="5" styleClass="searchTable"
style="width: 60%;margin: 0 auto;">
<p:outputLabel value="Select file to upload123" />
<p:fileUpload id="uploadFileData"
value="#{myBean.m_fileActualVolFile}" mode="simple"
skinSimple="true" style="width:80px;" widgetVar="uploadFileData"
allowTypes="/(\.|\/)(csv)$/" required="false"
requiredMessage="Select a file to upload..." />
</h:panelGrid>
<h:panelGrid style="margin-top: 10px" columns="1" styleClass="buttonGridStyle">
<h:panelGroup>
<p:commandButton value="Upload" id="uploadBtn"
onclick="PF('confirmDialog').show();"
ajax="true" global="true" />
<p:commandButton value="Cancel" id="cancelBtn"
action="#{myBean.cancelImport()}"
immediate="true" />
<div style="display: none">
<p:commandButton id="hiddenUpload" value="Import File Hidden"
onclick="PF('pbAjax').start();"
action="#{myBean.uploadMonthlyClicked}" ajax="false" />
<p:commandButton value="Start" id="startProBar" type="button"
onclick="start()" ajax="false" update="progressBarClient"
widgetVar="startButton1" />
</div>
<center style="margin-top: 15px">
<p:progressBar widgetVar="pbAjax" ajax="true" global="false"
value="#{myBean.progress}"
labelTemplate="{value}%" styleClass="animated"
style="width:300px">
</p:progressBar>
</center>
</h:panelGroup>
</h:panelGrid>
</p:fieldset>
<h:panelGrid columns="1" cellpadding="5" style="margin: 0 auto;">
<p:commandButton id="exportToExcel123" value="Export To Excel"
action="#{myBean.exportToExcel}"
update="messages" ajax="false" global="false"
rendered="#{myBean.viewMyDVO.m_strProductionvolumeType eq 'AU' ||
myBean.viewMyDVO.m_strProductionvolumeType eq 'BU' }">
</p:commandButton>
</h:panelGrid>