cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joerg Heinicke <joerg.heini...@gmx.de>
Subject Re: Antwort: Re: cforms : retrieve multiplevaluefield
Date Tue, 06 Jul 2004 12:47:15 GMT
On 06.07.2004 12:00, Stephane Delort wrote:
> 
> My datatype is String for both MVF.
> 
> I would have writen something like :
> 
> // this is ok
> cocoon.request.setAttribute("myForm", form.getWidget());
> var reqAttf = cocoon.request.getAttribute("myForm");

Don't know what you are trying here. You simply set a request attribute 
value and retrieve it? var reqAttf = form.getWidget(); works then also.

> var myMVFWidget  = reqAttf.lookupWidget("myMVF");
> 
> // this does not work and is still a mystery for me (the cats seems to be
> not allowed in javascript)
> Array myArray = (Array) myMFVWidget.getValue();

I meant String[] instead of JavaScript's Array. Furthermore you must 
have in mind that JS is not type save, so there is no cast operator. The 
code should be something like:

var myStringArray = myMFVWidget.getValue();

for (var i = 0; i < myStringArray.length(); i++) {
     var value = myStringArray[i];
     // do something with it
}

Joerg

>>>Hi,
>>>
>>>I am trying to get my cforms multipleValueFields.
>>>I tried to get the values of the user's selected fields.
>>>Thus, I really don't know how to do this since the getValue() of the
>>>multiplevaluefield widget return an objetc.
>>>This object is an array but I don't know how to cast the object to be an
>>>Array an then, retrieve my values ?
>>>
>>>Any idea or sample ?
> 
> 
>>What's your datatype of that field? The object should be an array of
>>that datatype.

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


Mime
View raw message