Hi,
I have a small use case where I have a inputfile and during upload I validate the file in the inputFile validator and reset the content.
In the validator, first I reset the file and I throw the ValidatorException, say for "file type not valid", So the thrown exception is shown in a bubble around the inputFile component and its content is also reset.
Now since the inputFile is reset, I expect a required exception when I simply press the submit button. But I instead get the same exception thrown before, The code is as follows,
JAVA
public void validator(FacesContext facesContext, UIComponent uIComponent,
Object object) {
inputFile.resetValue();
inputFile.setValid(false);
throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, null, "File type is not valid"));
}
JSPX
<af:form id="f1" usesUpload="true" defaultCommand="cb1">
<af:inputFile label="Label 1" id="if1"
binding="#{pageFlowScope.SampleBean.inputFile}"
required="true"
validator="#{pageFlowScope.SampleBean.validator}"/>
<af:commandButton text="submit" id="cb1" partialSubmit="false"/>
</af:form>
I am using jdev 11.1.1.7