1 Reply Latest reply on Oct 9, 2007 4:47 PM by stephen.friedrich

    s:fileUpload doesn't preserve pending value after immediate

    steve tynor Novice

      Seam 2.0.0.CR1

      I have a form containing several h:inputText's, a s:fileUpload and an h:commandButton that is used to add an item to a server-side Set, which is then used to draw a dataTable on the facelet. (I'm in a manually flushed transaction:

      @Begin(flushMode=FlushModeType.MANUAL, join=true)
      


      I use this sort of button on several forms without any trouble, but I'm having problems when there is an s:fileUpload control on the form -- when the button action fires and the screen refreshes, all the other controls (select boxes, text inputs, etc.) preserve their as-yet-unpersisted values, but the filename selected by the file upload control is cleared.

      Is this a bug in s:fileUpload? Can I workaround somehow?

      <s:decorate id="txtDecoration" template="/WEB-INF/facelets/templates/edit.xhtml">
       <ui:define name="label">Text</ui:define>
       <h:inputText id="txt" value="#{myHome.instance.txt}"/>
      </s:decorate>
      <s:decorate id="fileDecoration" template="/WEB-INF/facelets/templates/edit.xhtml">
       <ui:define name="label">File</ui:define>
       <s:fileUpload id="file" data="#{myHome.data}" required="true"
       contentType="#{myHome.contentType}"
       fileName="#{myHome.fileName}" accept="application/pdf" />
      </s:decorate>
      <s:decorate id="addDecoration" template="/WEB-INF/facelets/templates/edit.xhtml">
       <h:commandButton id="add" value="Add" immediate="true"
       action="#{myHome.addItem}"/>
      </s:decorate>
      ...