Johannes 
 
Follow-up to post prior to this one - you said:
 
var model=form.getModel();
model.language[0] = 1;
 
In my code, when I try do this, I get a
java.lang.NullPointerException.
starting off:
 
at
org.apache.cocoon.forms.flow.javascript.ScriptableWidget.has(ScriptableWidget.java:96)
at
org.mozilla.javascript.ScriptRuntime.setElem(ScriptRuntime.java:1050)
at
org.mozilla.javascript.Interpreter.do_setElem(Interpreter.java:2705)
....

Derek

>>> Johannes Textor <[EMAIL PROTECTED]> 2007/06/08 10:00 AM >>>

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] 



-- 
This message is subject to the CSIR's copyright, terms and conditions and
e-mail legal notice. Views expressed herein do not necessarily represent the
views of the CSIR.
 
CSIR E-mail Legal Notice
http://mail.csir.co.za/CSIR_eMail_Legal_Notice.html 
 
CSIR Copyright, Terms and Conditions
http://mail.csir.co.za/CSIR_Copyright.html 
 
For electronic copies of the CSIR Copyright, Terms and Conditions and the CSIR
Legal Notice send a blank message with REQUEST LEGAL in the subject line to
[EMAIL PROTECTED]


This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to