You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Gunter D'Hondt <gu...@sofico.be> on 2006/02/13 11:31:37 UTC

get values from multivaluefield

I'm trying to get the string array from a multivaluefield widget; so 
something like getValues() which returns an Object[] instead of the 
getValue() which returns an Object. Is there a reason why the getValues() 
is not implemented while the setValues() and setValue() is?

MultiValueField myfield = (MultiValueField) myform.getWidget("mywifes");
String[] myvalues = (String[]) myfield.getValue();
--> which doesn't work since casting from Object to String[] gives a 
ClassCastException

Regards,
Gunter D'Hondt


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


Re: get values from multivaluefield

Posted by Gunter D'Hondt <gu...@sofico.be>.
sorry my bad; solved with:

Object[] myvalues= (Object[]) myfield.getValue();
... myvalues[i].toString() ...



 



Gunter D'Hondt <gu...@sofico.be> 
13/02/2006 11:31
Please respond to
users@cocoon.apache.org


To
users@cocoon.apache.org
cc

Subject
get values from multivaluefield






I'm trying to get the string array from a multivaluefield widget; so 
something like getValues() which returns an Object[] instead of the 
getValue() which returns an Object. Is there a reason why the getValues() 
is not implemented while the setValues() and setValue() is?

MultiValueField myfield = (MultiValueField) myform.getWidget("mywifes");
String[] myvalues = (String[]) myfield.getValue();
--> which doesn't work since casting from Object to String[] gives a 
ClassCastException

Regards,
Gunter D'Hondt


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




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