Sid Muthiah
Sid Muthiah

Reputation: 53

primefaces p:selectBooleanButton listener not triggered in nested ui:repeat

The listener is triggered for the p:selectBooleanButton in parent ui:repeat, but the listener for p:selectBooleanButton is not triggered for the inner/child ui:repeat.

We cannot use nested forms. Any suggestions.

<h:form prependId="false">
 <ui:repeat value="#{xBean.sectionsList}" var="sectionItem">
  <p:fieldset>
   <p:selectBooleanButton onLabel="ON" offLabel="OFF" value="#{sectionItem.checked}">
    <p:ajax listener="#{xBean.selectSection}"/>
   </p:selectBooleanButton> :
   <ui:repeat value="#{sectionItem.sectionOptionsList}" var="sectionOptionItem">            
    <p:selectBooleanButton onLabel="ON" offLabel="OFF" value="#{sectionOptionItem.checked}">
     <p:ajax listener="#{xBean.selectSectionOption}"/>
    </p:selectBooleanButton>
    </ui:repeat>
   </p:fieldset>
 </ui:repeat>
</h:form>

Upvotes: 5

Views: 1319

Answers (1)

Kishor Prakash
Kishor Prakash

Reputation: 8151

The <ui:repeat> is a view render time tag. Thus, it's physically present in the JSF component tree and generates its HTML output as many times as it needs to iterate over the value.

In other words, they(p:selectBooleanButton) needs to be prepared during the view build time instead of the view render time.

The JSTL <c:forEach> is a view build time tag. It will generate physically multiple components into the JSF component tree.

Upvotes: 2

Related Questions