You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Rob Oxspring <ro...@imapmail.org> on 2006/05/04 14:55:04 UTC

[CForms] Combo box close equivelant

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.

Any advice on the best way forward would be appreciated,

Rob

(using Cocoon 2.1.9)


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


Re: [CForms] Combo box close equivelant

Posted by Jason Johnston <co...@lojjic.net>.
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