cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Johannes Textor <jc.tex...@gmx.de>
Subject Re: Styling an fd:multivaluefield item?
Date Fri, 08 Jun 2007 07:09:52 GMT
Derek,

I think Joerg is making the following point: In the form *definition*, 
you just define the set of *possible* values for a field, e.g.:

     <fd:multivaluefield id="language">
        <fd:label>Select language</fd:label>
        <fd:datatype base="integer"/>
        <fd:selection-list>
            <fd:item value="1"><fd:label>english</fd:label></fd:item>
            <fd:item value="2"><fd:label>german</fd:label></fd:item>
            <fd:item value="3"><fd:label>french</fd:label></fd:item>
        </fd:selection-list>
     </fd:multivaluefield>

Then which fields are actually selected depends on the object you're 
editing, i.e., must be set in the form's *model*. In flowscript:

var form = new Form("formdef.xml");
var model = form.getModel();

model.languages[0] = 1;
model.languages[1] = 3;

form.showForm("my-form");

This will yield the following form *instance*:

<fi:multivaluefield id="language">
<fi:label>Select language</fi:label>
    <fi:values>
       <fi:value>1</fi:value>
       <fi:value>3</fi:value>
    </fi:values>
    <fi:selection-list>
            <fi:item value="1"><fi:label>english</fi:label></fi:item>
            <fi:item value="2"><fi:label>german</fi:label></fi:item>
            <fi:item value="3"><fi:label>french</fi:label></fi:item>
    </fi:selection-list>
</fi:multivaluefield>

So there is no need for a "selected="true"" or similar attribute on the 
items of the selection list.

Cheers,
Johannes

Derek Hohls wrote:
> Joerg
>  
> Sorry, what you are saying is very unclear to me... I have given
> code examples of what I want to achieve - if you could show me
> code examples of how to do this, then understanding would be
> achieved!
>
> (I have tried to explain again in another post what it is I am
> trying to get to.)
>  
> Derek
>   


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


Mime
View raw message