You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Joerg Heinicke <jo...@gmx.de> on 2004/12/07 20:36:51 UTC

Re: [CForms] booleanfield, on-value-change => display form fields

>> Don't know about this sample, but it should be similar. Referencing 
>> the boolean field as case widget should work IIRC. I have done it 
>> myself, I could have a look at latest at monday. The rest should be 
>> the same like the selection list sample.

I promised something, but did not make it to send it here. So somewhat 
late here is my example:

in form definition:

<fd:booleanfield id="newAddressKnown">
   <fd:label><i18n:text key="newAddressKnown"/></fd:label>
   <fd:on-value-changed>
     <javascript>
       var widget = event.source;
       var stringWidget = 
event.source.parent.getChild("newAddressKnownString");
       stringWidget.value = new java.lang.String(widget.value);
     </javascript>
   </fd:on-value-changed>
</fd:booleanfield>
<fd:output id="newAddressKnownString">
   <fd:datatype base="string"/>
</fd:output>
<fd:union id="newAddress" case="newAddressKnownString">
   <fd:widgets>
     <fd:struct id="true">
       <fd:widgets>
         ... the optional widgets ...
       </fd:widgets>
     </fd:struct>
   </fd:widgets>
</fd:union>

in form template:

<ft:widget id="newAddressKnown">
   <fi:styling submit-on-change="true"/>
</ft:widget>
<ft:union id="newAddress">
   <ft:case id="true">
     <ft:struct id="true">
       ... the optional widgets ...
     </ft:struct>
   </ft:case>
</ft:union>

Hope it helps. If someone can integrate it into the Cocoon samples, I 
would be happy to commit it.

Joerg

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