cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nacho Jimenez <n...@ya.com>
Subject Re: Trying to get a selectionlist label into a binding
Date Fri, 16 Apr 2004 14:46:00 GMT
Joerg Heinicke wrote:

> On 14.04.2004 20:18, Nacho Jimenez wrote:
>
>> Hello all,
>>      I've got a (woody) form with lots of widgets. One of them is a 
>> selection list that let's you choose a user, with the full name as 
>> label and the login name as value of the selection list.
>>      I'm binding the form into an xml file, and would like to bind 
>> this information to:
>>      <user id="natz">Nacho Jimenez de Luis</user>
>>
>>    The only idea that springs to my mind is to use a <wb:javascript> 
>> bindng and on the on-save option, access the widget directly, but i 
>> don't know wehre to get the selection's label from, not the widget's 
>> label.
>>
>>    I'm out of ideas here, can someone point the right way?
>
>
> To clear up the picture:
>
> You have a form defined with a field widget and a selection list.
>
> You want to fill the selection list with an XML.

No, that's easy and I already have taken care of it..

Right now my field widget is already a selection list populated with a 
list of users... (sttatic version, for sake of simplicity)

        <wd:field id="user" required="true">
            <wd:label>Usuario</wd:label>
            <wd:datatype base="string"/>
            <wd:selection-list>
              <wd:item value="natz">
                <wd:label>Nacho Jimenez</wd:label>
              </wd:item>
               <!-- etc -->
              <wd:item value="otro">
                <wd:label>Otro Distinto</wd:label>
              </wd:item>
            </wd:selection-list>
        </wd:field>

What i need is to store the selection in an XML as:

    <user id="natz">Nacho Jimenez</user>

    The first binding is simple:

      <wb:value id="user" path="user/@id"/>

    But I just don't know how to do the second.. I guess it could be 
something like:
   
    <wb:javascript id="user" path="user" direction="save">
         <wb:save-form>
             widget.function.that.gets.the.selection's.label()
        </wb:save-form>
    </wb:javascript>

    Any idea?

> Another question is where you want to store the value at the end.
>
> And if you still want to do it via binding, like I did it, but with 
> beans and not for XML, have a look at 
> http://wiki.cocoondev.org/Wiki.jsp?page=WoodyBinding and search for 
> wb:javascript there.



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


Mime
View raw message