0
So, guys, I have a fileUpload component from primefaces for uploading files. It turns out that even with the required="true", if the user click submit without having uploaded any file the system sends.
<p:fileUpload
required="true"
requiredMessage="Comprovante ou declaração de vínculo de trabalho: item obrigatório"
fileUploadListener="#{comprovanteBean.uploadArquivoDespesaTransporte}" update="@form"
label="Arquivo" uploadLabel="Enviar" cancelLabel="Cancelar"
allowTypes="/(\.|\/)(gif|jpe?g|png|pdf)$/"
invalidFileMessage="São permitidos apenas arquivos do tipo: jpeg, jpg, png, pdf)"
sizeLimit="1048576"invalidSizeMessage="O tamanho máximo permitido é de 1 MB."
fileLimit="1">
</p:fileUpload>
<p:commandButton value="Enviar comprovantes" update="@form" ajax="false" action="#{comprovanteBean.finalizarInscricao()}">
<f:param name="inscricaoFinalizada" value="true"/>
</p:commandButton>
On the site of the first faces their button is locked, but not active when I upload, then I could not get their code: https://www.primefaces.org/showcase/ui/file/upload/basic.xhtml
Does anyone have any idea how to not allow the user to register without sending this file??