myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Kienenberger <mkien...@gmail.com>
Subject Re: h:inputFile required attribute don't work
Date Wed, 29 Apr 2015 16:00:50 GMT
My apologies for the late reply.

Any chance you can create an issue for this in our JIRA issue tracker
and submit a patch with a fix?


On Tue, Apr 14, 2015 at 10:37 AM, Vojtěch Zavřel <vojtech.zavrel@aura.cz> wrote:
> Hi,
>  it seems to me, that the required attribute of h:inputFile is not working.
> The reason is, that there is always an instance of javax.servlet.http.Part
> in submitted value and there should be something like part.getSize() <= 0 in
> getConvertedValue() or maybe overriden isEmpty method of UIInput class where
> is basic types emptiness check.
>
> You can repeat that problem just on a simple form with h:inputFile, with
> required="true" without any validator.
>
>     <h:form id="inputForm" enctype="multipart/form-data">
>
>        <!-- inputFile tag to upload file -->
>         Upload File
>         <h:inputFile id="file"
>                      label="file"
>                      value="#{inputBean.part}"
>                      required="true"
>                      requiredMessage="File not selected !!">
>         </h:inputFile>
>         <h:message style="color: red" for="file" /><br />
>
>         <h:commandButton id="submit"
>                          action="#{inputBean.uploadFile}"
>                          value="upload file" /><br />
>     </h:form>
>
> Testing on Tomcat 7.0.59, MyFaces 2.2.6
>
> --
> Mgr. Vojtěch Zavřel
> System architect
>  AURA, s.r.o.
> Úvoz 499/56
> 602 00 Brno
> Czech Republic
>
> Tel.: +420 544 508 181
> Fax: +420 544 508 112
> E-mail: vojtech.zavrel@aura.cz
> Internet: www.aura.cz
>  Certifikace ISO 9001, ISO 8000, ISO 27001 a ČOS 051622 (AQAP 2110)
>

Mime
View raw message