On Thu, 2003-10-16 at 11:47, Kim Jelmoni wrote:
> Hi,
> 
> I m trying to fill a selection list with a collection using woody and 
> cocoon 2.1.3-dev  .
> 
> I got in select_bind_bind.xml
> 
> <wb:context xmlns:wb="http://apache.org/cocoon/woody/binding/1.0"; path="/" >
>  
>  <wb:repeater id="aliases"
>     parent-path="."
>     row-path="aliases"
>     unique-row-id="aliasId"
>     unique-path="@aliasId">
> 
>     <wb:on-bind>
>       <wb:value id="aliasId" path="aliasId"/>
>       <wb:value id="aliasText" path="aliasText"/>
>     </wb:on-bind>
>   </wb:repeater>
> 
> </wb:context>
> 
> and in the model  i tried something like :
> 
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <wd:form
>   xmlns:wd="http://apache.org/cocoon/woody/definition/1.0";
>   xmlns:i18n="http://apache.org/cocoon/i18n/2.1";>
> 
>   <wd:field id="aliasesWzd" required="false">
>     <wd:label>Chose the error <b>level</b> to show</wd:label>
>     <wd:datatype base="string"/>
>     <wd:selection-list  dynamic="true">
>            <wd:repeater id="aliases">
>                 <wd:item id="aliasId">
>               <wd:label id="aliasText" />
>             </wd:item>
>         </wd:repeater>
>      </wd:selection-list>
>    </wd:field>
>  
> </wd:form>
> 
> that don't work (null pointer exception).
> 
> How should be done ?

Setting a selection list using the binding is currently not supported.
Using the wd:selection-list tag you can either refer to an external
source (using the src attribute), or list the items inline in the form
definition.

Putting a repeater inside a wd:selection-list element makes no sense at
all. A repeater is a widget and can only appear where widgets are
allowed, i.e. as child of the wd:form or wd:repeater elements. Inside
wd:selection-list only wd:item's are allowed. Also, the dynamic
attribute you used only has a meaning when used in combination with the
src attribute.

If you want a selectionlist to be filled with data from a collection,
you need to create an implementation of the SelectionList interface, and
then you can call field.setSelectionList(...) with as parameter your
selection list.

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]                          [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to