I'm trying to put validation in my <p:fileUpload>
. when the user upload without putting any file he get's an error message. I'm using mode="simple"
and required="true"
but required="true"
doesn't work.
P.S: I need to use mode="simple"
because I need <p:commandButton>
to submit other data.
<p:panelGrid columns="2">
<h:outputLabel id="image" value="Select Image: *" />
<p:fileUpload value="#{Jcalendar.file}" mode="simple"
allowTypes="/(\.|\/)(gif|jpe?g|png)$/"
required="true"
requiredMessage="File not selected !!"/>
<f:facet name="footer">
<p:commandButton value="Submit"
ajax="false"
action="#{Jcalendar.Upload}"
update=":form:msgs" />
</f:facet>
</p:panelGrid>