cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Johnston <coc...@lojjic.net>
Subject Re: [CForms] Combo box close equivelant
Date Sat, 06 May 2006 22:33:42 GMT
Rob Oxspring wrote:
> Hi,
> 
> Just thought I'd ping the list to find out if there is a recommended
> best practice for setting up a combo box style field within cforms.  At
> present we have a pair of controls being used - a select list and a text
> box and have a custom validator that ensures exactly one of them is
> filled in.
> 
> So the form def contains:
>     <fd:field id="customerList" required="false">
>       <fd:label>Customer</fd:label>
>       <fd:datatype base="string"/>
>       <fd:selection-list type="flow-jxpath" list-path="customers"
> value-path="value" label-path="label"/>
>     </fd:field>
>     <fd:field id="customer" required="false">
>       <fd:datatype base="string"/>
>     </fd:field>
> 
> And the javascript includes:
>     form.getChild('customer').addValidator(new
> JavaAdapter(WidgetValidator, new XorValidator('customer','customerList')));
> 
> Ideally I'd like to define a single <fd:field> element and have cforms
> expand that into the list + text input combination, especially as I
> think this will work better if/when we replace the plain html styling
> with something richer like activewidgets.
> 


Have you seen the new Suggestion List feature in the most recent
release? There's a sample at
http://cocoon.zones.apache.org/demos/release/samples/blocks/forms/do-suggest.flow

Seems like that does what you're asking for.  In terms of setup it's
very much like using selection lists; instead of fd:selection-list you
use fd:suggestion-list.  The AJAX list population is all handled
automatically by the framework.  Very slick.

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


Mime
View raw message