cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <sylv...@apache.org>
Subject [cforms] new validation: every widget can have a validator
Date Wed, 04 Feb 2004 17:50:21 GMT
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

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }
Orixo, the opensource XML business alliance  -  http://www.orixo.com



Mime
View raw message