Friday, October 4, 2013

ADF how-to: using af:message component inside an af:iterator

Sometimes you need create dynamic collections of form elements. What more you might want to have collecion with variable number of elements/rows. In this situation you would use af:iterator and inside this component any set of inputs like af:inputText. When you also need validate those inputs, achieving the desired effect can be difficult, especially when you want to use separate af:message against each input component.

The problem is that when a control is used inside an iterator, its ID changes internally to account the fact that there would be otherwise duplicate IDs. Cause of this if the af:message component is not configured properly for the iterator, it woludn't work properly.

Here is an example hot to use af:message components inside af:iterator:
<af:iterator id="i1" value="#{backingBeanScope.MyBean.listForIterator}" varStatus="vs">

    <af:inputText label="Input #{vs.index}" id="it1">

          <af:validateLongRange minimum="5" maximum="10"/>


    <af:message id="m1" for="#{vs.index}:it1"/>



No comments:

Post a Comment