I'm using PrimeFaces' simple fileUpload
and a custom submit button, something like this:
<h:form enctype="multipart/form-data">
<p:fileUpload value="#{fileController.file}"
mode="simple"
skinSimple="true"
label="choose file"/>
<p:commandButton value="upload"
ajax="false"
label="upload"
icon="fa fa-upload"
actionListener="#{fileController.upload}"/>
</h:form>
In the backing bean, file
is a property of type UploadedFile
.
Now I want to disable the upload
button if no file is selected yet, but I fail to get the Information whether the user has selected a file or not the file
property remains null
until the upload
button is clicked). I tried the valueChangeListener
on the <p:fileUpload>
component, but the event is only fired when I click the upload button (but then it's too late)
Anyone has a suggestion?