cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joerg Heinicke <>
Subject Re: [cforms] new validation: every widget can have a validator
Date Wed, 04 Feb 2004 19:11:34 GMT
 From the form1 sample (shortened):

<wd:repeater id="contacts">
   	  for (var i = 0; i &lt; widget.size; i++) {

Which properties are available here? Obviously widget, but maybe also 
form? This would be cool as I can replace the XReporter asserts that I 
have problems with.

contact name", false));

Must we specify ?? It seems 
to be to much typing. What about just setValidationError(String [, more 
parameters])? Do we loose flexibility? At the moment there is only 
o.a.c.w.validation.ValidationError and the deprecated extending 

BTW, shouldn't the sample create a non-deprecated ValidationError?



On 04.02.2004 18:50, Sylvain Wallez wrote:

> Hi peeps,
> I finally managed to finish the new style of validation we discussed a 
> while ago.
> This new validation allows *any* widget to have a validator. The 
> immediate effect is that <wd:validator> is now outside of <wd:datatype> 
> since not all widgets have a datatype.
> The validator interface has also changed, since not all widgets are 
> capable of displaying a validation error. A validator now has the 
> responsibility, if validation fails, to set a ValidationError on the 
> validated widget itself or one of its children. Widgets that accept a 
> validation error implement the ValidationErrorAware interface.
> The existing validators have been wrapped with an adapter and are 
> therefore still supported, although deprecated.
> I updated the form1 definition in the samples: moved the validation 
> outside the datatype, and added a validation on the repeater that checks 
> if contact names are disctinct among the different rows. This sample 
> uses a new JavaScriptValidator that allows validator to be written as a 
> JS snippet.
> Enjoy,
> Sylvain

View raw message