I have a dialog that has a fileupload (basic) inside it. Because this, the dialog is in a seperate form, with enctype="multipart/form-data". I have my p:commandButton on ajax="false". When I fill everything in, the form is posted like it should and the file is uploaded.
Code: Select all
<h:form enctype="multipart/form-data">
<p:dialog widgetVar="newMessageDialog" header="NEW MESSAGE" styleClass="message-detail-window" modal="true" draggable="false" closeOnEscape="true" resizable="false" hideEffect="fade" showEffect="fade" style="min-width: 800px;" >
<p:messages for="dialogMessages" autoUpdate="true" showDetail="true" showSummary="false" />
<p:panelGrid columns="2" styleClass="ui-panelgrid-blank">
<h:outputLabel value="#{messaging_msg.mimetype}" />
<p:inputText value="#{uploadBean.mimeType}" styleClass="clean-border" style="margin-bottom: 0px;" />
<h:outputLabel value="FILE" />
<p:fileUpload value="#{uploadBean.uploadedFile}" mode="simple" skinSimple="true" label="BROWSE" />
<h:outputLabel value="#{messaging_msg.password}" />
<p:password value="#{uploadBean.password}" styleClass="clean-border" />
<h:outputLabel value="" />
<p:commandButton value="SEND" styleClass="button success dialogButton" ajax="false" actionListener="#{uploadBean.handleFileUpload()}" style="float: right;" />
</p:panelGrid>
</p:dialog>
</h:form>
My question: is there a way to validate the inputs, and show the validation message, without posting the form? That way, the dialog isn't closed and the messages are shown.