cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Portier <...@outerthought.org>
Subject Re: Woody: How to bind multivaluefield ?? HELP
Date Sun, 07 Dec 2003 20:33:44 GMT
Marcin,

Binding of multi-value fields is not supported yet.

I think most people currently go for repeater-binding for this kind of 
stuff, but of course that drives the choice for your UI widget away from 
what you wanted to use in the first place.

Any ideas on sensible use cases and declarations for this kind of 
binding are welcome, you might consider adding those proposals to 
bugzilla (and spare yourself some typing by including a URL to some 
mail-archive-service) since we've recently started using that medium 
also as a way to gather and manage upcoming features and requirments.


some thoughts in this area:
- do we want binding to/from different elements in the backend only
- or should we also provide some convertor approach that maps the 
multiple values on some delimited values in a string?
- multivalue-lists are really unordered sets, while 
backend-repeated-elements are sometimes ordered Collection-types (list, 
array)


regards,
-marc=




Marcin Okraszewski wrote:

> Hi,
> I want to bind a multivalue field to a bean. It doesn't work while other 
> fields are bind correctly. How should I bind it if my data type is 
> long??? I tried with Collection of Long, Long[] and long[].
> 
> Here is my case (extracts):
> 
> 1) model:
> 
> <wd:form>
>   <wd:widgets>
>     ...
>     <wd:multivaluefield id="admins">
>       <wd:label>admins</wd:label>
>       <wd:datatype base="long"/>
>       <wd:selection-list>
>         <wd:item value="1">
>           <wd:label>user1</wd:label>
>         </wd:item>
>         <wd:item value="2">
>           <wd:label>user2</wd:label>
>         </wd:item>
>        ...
>       </wd:selection-list>
>     </wd:multivaluefield>
>     ...
>   </wd:widgets>
> </wd:form>
> 
> 2) binding:
> 
> <wb:context  path="/" >
>   ...
>   <wb:value id="admins" path="admins"/>
>   ...
> </wb:context>
> 
> 3) bean:
> 
> public class Department {
>     ...
>     // I also tried with Long[] and Collection instead of long[]
>     public long[] getAdmins() {
>         long[] admins = { 1, 2 };
>     return admins;
>     }
>     public void setAdmins(long[] admins) {
>     }
>     ...
> }
> 
> 6) Page before transform
> 
> ...
> <wt:form-template action="#{$continuation/id}.continue" method="POST">
>   ...
>   <wt:widget id="admins"/>
>   ...
> </wd:form-template>
> ...
> 
> 5) Woody transformer output:
> 
> ...
> <wi:multivaluefield id="admins">
>   <wi:values/>
>   <wi:label>admins</wi:label>
>   <wi:selection-list>
>     <wi:item value="1">
>       <wi:label>user1</wi:label>
>     </wi:item>
>     <wi:item value="2">
>       <wi:label>user2</wi:label>
>     </wi:item>
>     ....
>   </wi:selection-list>
>   <wi:styling/>
> </wi:multivaluefield>
> ...
> 
> As you see, the <wi:values> are empty! What is wrong?
> 
> Regards,
> Marcin Okraszewski
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 

-- 
Marc Portier                            http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
Read my weblog at                http://blogs.cocoondev.org/mpo/
mpo@outerthought.org                              mpo@apache.org


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


Mime
View raw message