You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Marcin Okraszewski <ok...@o2.pl> on 2003/12/06 21:26:34 UTC

Woody: How to bind multivaluefield ?? HELP

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


Re: Woody: How to bind multivaluefield ?? HELP

Posted by Marcin Okraszewski <ok...@o2.pl>.
> Binding of multi-value fields is not supported yet.

[...]

> Any ideas on sensible use cases and declarations for this kind of 
> binding are welcome

My case is very simple - I want to make groups of users. Multivalue 
seems to be the most reasonable.

At the very moment I simply set values in flowscript. If I have more 
time I'll look into it and maybe code that binding. But unfortunately 
I'm deficient in time so probably someone else will do it first :-(

Regards,
Marcin Okraszewski


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


Re: Woody: How to bind multivaluefield ?? HELP

Posted by Marc Portier <mp...@outerthought.org>.
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


Re: Woody: How to bind multivaluefield ?? HELP

Posted by Jean-Christophe Kermagoret <jc...@babelobjects.com>.
Hi,
I'm trying to use the <wi:styling type="output"/> but it doesn't seem to 
work.
Is there anybody that uses it with success ?

When I look at the intermediate style sheet, I see a double tag :
<wi:styling>
    <wi:styling type="author"/>
</wi:styling>

Is it normal ?

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
>
>


-- 

Jean-Christophe Kermagoret
jck@BabelObjects.Com



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