3 Replies Latest reply on Jun 27, 2007 6:03 PM by David Fedchenko

    Decorating with a fileUpload tag

    David Fedchenko Newbie

      --Seam 1.2.1 standard setup--

      I have this page source:

      <s:decorate id="uploadDecor_#{idx}" template="/WEB-INF/template/edit.txml">
       <ui:define name="label">
       #{messages.attachFileLabelFile}
       </ui:define>
       <ui:define name="guidance">
       #{messages.attachFileGuidanceFile}
       </ui:define>
       <s:fileUpload id="upload_#{idx}" data="#{doc.fileData}"
       fileName="#{doc.fileName}"
       contentType="#{doc.contentType}"/>
      </s:decorate>
      


      with this template:

      <s:div styleClass="prop #{invalid?'errors':''}">
       <s:label styleClass="name">
       <ui:insert name="label"/>
       </s:label>
      
       <s:span styleClass="value">
       <ui:insert/>
       </s:span>
      
       <s:message styleClass="error errors"/>
      
       <s:span styleClass="guidance">
       <s:fragment rendered="#{invalid}">
       <s:message/>
       <br/>
       </s:fragment>
       <ui:insert name="guidance"/>
       </s:span>
      </s:div>
      


      And I get these complaints in the console:

      18:59:50,935 WARN [HtmlLabelRenderer] Attribute 'for' of label component with id attachFile:_id75 is not defined
      18:59:51,935 ERROR [HtmlMessageRendererBase] Attribute 'for' of UIMessage must not be null
      


      When I break into HtmlMessageDecoration.getInputId() I see that it walks through the subtree of the decorate tag looking for an EditableValueHolder subclass to get the id to insert in the 'for' tag. It doesn't think the fileUpload qualifies and doesn't set a 'for' attribute. HtmlLabelDecoration has the same problem.

      The result is that clicking on the label doesn't focus the input field and the field specific error messages don't show up.

      Is there an easy way to solve this?