2 Replies Latest reply on Oct 13, 2007 12:10 PM by sbozdag

    s:fileupload validation

    sbozdag

      Hi,

      I am trying to make sure that user specified a file to upload. @NotNull did not worked. I have then read something on SeamProblemsFAQ (http://wiki.jboss.org/wiki/Wiki.jsp?page=SeamProblemsFAQ) about a @NotNull issue.

      I am now using required attribute for s:fileupload . But it did not worked for me..

       <h:form id="fileUploader" enctype="multipart/form-data">
       <h:panelGrid columns="2">
       <h:outputLabel for="file">File:</h:outputLabel>
       <s:fileUpload id="file" data="#{fileUploader.resultsFile}"
       contentType="#{fileUploader.contentType}"
       required="true"
       requiredMessage="You must specify a file"/>
       </h:panelGrid>
      
       <!-- Buttons and other stuff -->
       ...
       </h:form>
      


      Thank you

        • 1. Re: s:fileupload validation
          christian.bauer

          Don't push the data directly into an entity, use an action component instead - probably the one you already have for the submit action. Then validate it in the submit action method manually.

          • 2. Re: s:fileupload validation
            sbozdag

            Thanks for replying. Yes, I am using an action component already. Annotations are really easy to use and maintain. That was the reason I would like to put them in.

            Anyway, I will make validation manually for data.

            cheers