cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruno Dumon <br...@outerthought.org>
Subject Re: basic cforms validation problem or bug?
Date Sun, 18 Jun 2006 09:22:10 GMT
On Wed, 2006-06-14 at 16:16 +0200, es wrote:
> I have 3 very basic cforms validation scenario 3 different problems with 
> them.
> 
> 1) I have a combo-box with with 1 2 3 as values, on-value-changed I 
> whant widget "Nliv1" "Nliv2" "Nliv3" to be WidgetState.ACTIVE and their 
> values to be back to 0 so I wrote:
> if (newValue == 1) {
>    var nliv2 = widget.lookupWidget("../Nliv2");
>    nliv2.setState(WidgetState.INVISIBLE);
>    nliv2.value = 0;
> I tried also with
>    nliv2.value = parseInt("0");
> but I got java.lang.RuntimeException: Incorrect value type for "Nliv2" 
> (expected class java.lang.Integer, got class java.lang.Double).
> but 0 is 0 not 0.0d.
> weird.

As the error message says, the value of the widget should be set to
something of type java.lang.Integer, so do:

nliv2.value = new java.lang.Integer(0);

> 2) This is probably a bug... in the same form "Nliv1" "Nliv2" "Nliv3" 
> sum must be equal to a value of another widget so I check for the same 
> assert condition and I need to display the same failmessage however only 
>   when "Nliv1" is ACTIVE I can see the failmessage in the other widget I 
> got "Error evaluating expression on assert validation rule"
> 3) In an another form a field called "ag" datatype "float" with 		 
> <fd:assert test="ag &lt; 0.7"> and I got java.lang.ClassCastException: 
> java.math.BigDecimal.

It seems like the field value is not being converted to a BigDecimal
when it is passed into the expression engine. I guess you're not yet
using Cocoon 2.1.9?

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@apache.org


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


Mime
View raw message