You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by es <es...@javanet.info> on 2006/06/14 16:16:53 UTC

basic cforms validation problem or bug?

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.
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.

Besides these problems with cforms I declare myself a happy cocoon user 
as my project is nearing completion and I'm willing to come (from 
Bologna Italy) at the next GetTogether @ Dublin however I can't find out 
again the email whith the url of the wiki and I was wondering if there 
is other information about the program and how many days it last. There 
is an offer _now_ 
http://www.ryanair.com/site/IT/fares.php?dest=DUB&base=BGY for 9.99 
euros I was booking but I don't know when to return. Any info 
appreciated... Anyone from Italy?

thanks
Eli

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


Re: basic cforms validation problem or bug?

Posted by Bruno Dumon <br...@outerthought.org>.
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