cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simone Gianni <s.gia...@thebug.it>
Subject Re: cforms - validating integers
Date Sun, 26 Feb 2006 22:37:12 GMT
Hi Kamal,
AFAIK you cannot (and don't need) to apply a fd:regexp to an integer, it 
should give you class cast exception. Validation is applied after 
conversion takes place, and the convertor for an integer will not allow 
presence of letters by itself.

Simone

Kamal Bhatt wrote:

>
> OK, this is a mistake on my part. This is a problem not with 
> validation as I thought but with form in general (ie it is not saving 
> even when the fields are valid). I will probably repost when I have  
> looked into this further.
>
> Cheers.
> Kamal Bhatt wrote:
>
>>
>> Hi
>> I have a cform with the following field:
>>
>>    <fd:field id="min_duration" required="false">
>>        <fd:label>Min Duration</fd:label>
>>        <fd:datatype base="integer"/>
>>        <fd:validation>
>>          <fd:regexp pattern="[0-9]*"/>
>>          <fd:range min="1" max="99">
>>            <fd:failmessage>Max duration must an integer greater than 
>> 1 and less than 99</fd:failmessage>
>>          </fd:range>
>>         </fd:validation>
>>    </fd:field>
>>
>> When I enter a non-integer character (eg 'a'), the cform fails on 
>> save. All other validation works, but obviously, validation does not 
>> work until the field is bound to the variable. My question is how to 
>> get the field to validate without using javascript (at the form 
>> template level) to do so (for the sake of consistency).
>>
>> Cheers.
>>
>> Kamal.
>>
>
>
-- 
Simone Gianni

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


Mime
View raw message