Derek,
Thanks; that is clearer. Am I correct in assuming that the :
<fi:values>
<fi:value>1</fi:value>
<fi:value>3</fi:value>
</fi:values>
will be displayed as "checked input boxes" with a:
<fi:styling list-type="checkbox"/>
I don't really know, since I do not use the "default" CForms
stylesheets, instead I normally create my own. It would certainly make
sense if that happened, though :)
I still do not understand the rationale for this; this approach
effectively means two sets of calls to the database to generate the
output (1) to create the *possible* values as fd:item, and (2) to
create the values which appear as fi:item. While doing the first
is straightforward, doing the second will mean placing another
database call inside of the flowscript, yes?
(2) appear as fi:value (not fi:item, those are simply the same as
fd:item), but I assume that was what you meant. Yes, two calls to the
database are needed - but that's normal, isn't it ? I mean, you usually
keep all possible values in one table and the n:m association between
objects and these values in another one.
Actually, it is possible to do both from flowscript with the following
syntax:
<fd:multivaluefield id="language">
<fd:label>Select language:</fd:label>
<fd:datatype base="integer"/>
<fd:selection-list id="language" type="flow-jxpath"
list-path="language" value-path="id" label-path="name"/>
</fd:multivaluefield>
and then in Flowscript:
var list;
list.language = new java.util.Vector();
list.language.add(getAllLanguagesFromDatabase());
/* For it to work, allLanguagesFromDatabase() must return a list of
POJOs that implement the methods getId() and getName() */
var form = new Form("formdef.xml");
var model = form.getModel();
model.languages[0] = 1;
model.languages[1] = 3;
form.showForm("my-form", list);
Thanks again for the clear code explanation! An example like this in
the docs would be great.
Derek
I agree that the docs on multivaluefields are more than sparse; checking
quickly, I did not find anything in the wiki either. Did not check the
samples, though, I guess there is one which covers this.
Cheers,
Johannes
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]