cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kamal Bhatt" <kbh...@tt.com.au>
Subject [CFORMS] Dynamically specifying Help and labels
Date Sun, 30 Dec 2007 06:02:57 GMT
Hi,
I have a requirement to dynamically allocate the help and labels for
fields in a repeater. My solution, uses jx templates to set fi:help and
fi:label, like so:

<ft:repeater-widget id="style_flds">
  <ft:widget id="value">
    <fi:label>
      <jx:out                       
value="${form.getChild('styles').getRow(style_idx).getChild('style_flds').getRow(repeaterLoop.index).getChild('label').value}"
/>
    </fi:label>
    <fi:styling                
type="${form.getChild('styles').getRow(style_idx).getChild('style_flds').getRow(repeaterLoop.index).getChild('fld_type').value}"
/>
    <fi:help>
      <jx:out                
value="${form.getChild('styles').getRow(style_idx).getChild('style_flds').getRow(repeaterLoop.index).getChild('help').value}"
/>
     </fi:help>
   </ft:widget>
</ft:repeater-widget>

This is a hack. Normally I would be fine with this, but as you can
probably guess we are using 2.1.7 CForms. My question is, if we upgrade
and get all ajaxy, what is the likelihood my hack will continue to work?

Another question, for the development team, has anyone thought about being
able to dynamically set labels in the definition? It seems like a rather
onerous assumption that ever field in a repeater will be labelled the same
way. What would be nice would be able to set state, label and headings in
the definition (where it belongs) using javascript. For example:

<fd:field id="value">
 <fd:datatype base="string" />
  <fd:state>
    <fd:javascript>
       if (blah) return(WidgetState.ACTIVE);
       else return(WidgetState.INVISIBLE);
    </fd:javascript>
  <fd:state>
  <fd:label>
    <fd:javascript>
       if (blah) return("First label");
       else return("Second label");
    </fd:javascript>
  </fd:label>
</fd:field>

Anyway, my two cents.

Cheers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message