cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew M <and...@jibeya.com>
Subject Re: Integer validation problem
Date Fri, 19 Nov 2004 19:23:08 GMT
Solution found:

   	<fd:javascript>
   		var success = true;
   		var items = neworder;
   		var quantity = widget.lookupWidget("quantity");
   		if (parseInt(quantity.value)) {
   			quantity.setValidationError(new 
Packages.org.apache.cocoon.forms.validation.ValidationError("Integer 
values ony allowed", false));
   			success = false;
		}
		
		
   		return success;
   	</fd:javascript>

<fd:widgets>
     <fd:field id="quantity">
       <fd:label>Quantity</fd:label>
       <fd:datatype base="integer"/>
     </fd:field>
</fd:widgets>

But, should this not already be handled by specifying integer??

Andrew

On 19 Nov 2004, at 19:08, Andrew M wrote:

> Hi,
> I have specified an integer based widget:
>
> <fd:widgets>
>     <fd:field id="quantity">
>       <fd:label>Quantity</fd:label>
>       <fd:datatype base="integer"/>
>     </fd:field>
> </fd:widgets>
>
> If I input:
>
> 1. 1234 - success (allowed)
> 2. qwer - success (not allowed)
> 3. 123r - fail (allowed) error then genertated after submit : Cannot 
> convert 123r to java.lang.Integer
>
> What is the solution here?
>
> many thanks
>
>
> Andrew
>

Mime
View raw message