I'm using Primefaces 5.3 and I want to do an ajax call when I upload my file
<p:fileUpload
id="fileUp"
fileUploadListener="#{carEditDocumentController.handleFileUpload}"
label="#{msg['document.selectDocument']}"
auto="true"
required="true"
requiredMessage="#{msg['error.required']}"
mode="advanced"
skinSimple="true"
update="carDocumentNewName">
<p:ajax listener="#{carEditDocumentController.checkDocument()}" event="???" update="carDocumentError"/>
</p:fileUpload>
Which event do I need to execute the listener when I upload my file?
Thank you.
I don't know of any event for that. But I believe there are 2 other options:
Just call checkDocument() from the fileUploadListener.
Call a remoteCommand in oncomplete:
<p:fileUpload ... oncomplete="rc()" />
<p:remoteCommand name="rc" update="carDocumentError" actionListener="#{carEditDocumentController.checkDocument()}" />