1 Reply Latest reply on Feb 3, 2008 6:14 PM by Pete Muir

    Facelets custom tags for input controls

    Gordon DuQuesnay Newbie

      In my view pages the input controls look like this:

       <div class="entry">
       <div class="label"><h:outputLabel for="DateofBirth">Date of Birth:</h:outputLabel></div>
       <div class="input">
       <s:decorate id="DateofBirthDecorator">
       <rich:calendar enableManualInput="true" disabled="#{!HomeFoneNameChange.isNewForm()}" id="DateofBirth" value="#{HomeFoneNameChange.dateofBirth}"
       required="true">
       <a:support event="onblur" reRender="DateofBirthDecorator" />
       </h:inputText>
       </s:decorate></div>
       </div>
      
       <div class="entry">
       <div class="label"><h:outputLabel for="Sex">Sex:</h:outputLabel></div>
       <div class="input"><s:decorate id="SexDecorator">
       <h:inputText size="50" disabled="#{!HomeFoneNameChange.isNewForm()}" id="Sex" value="#{HomeFoneNameChange.sex}"
       required="true">
       <a:support event="onblur" reRender="SexDecorator" />
       </h:inputText>
       </s:decorate></div>
       </div>
      


      I feel like there should be a way to cut down on the amount of repeated text using facelets but I'm not sure of the best way to do it.

      I'd like to be able to do this:

      <my:calendar lable="Date of Birth" bean="HomeFoneNameChange" property="dateOfBirth" />
      <my:inputText lable="Sex:" bean="HomeFoneNameChange" property="sex" />
      


      or even better, specify the bean once per page and have:


      <my:calendar lable="Date of Birth" property="dateOfBirth" />
      <my:inputText lable="Sex:" property="sex" />
      


      is this possible? or if not how close to this can I get?