[html-formfu] Validating unique names

Ton Voon ton.voon at altinity.com
Wed May 14 19:55:25 BST 2008

On 14 May 2008, at 17:45, Ton Voon wrote:

> $field->validator('Object')->object( $object );

I've just thought this is too limiting, because this means there's  
only one method (validate_value) per object class.

So instead, I propose this syntax:

$field->validator( $object )->method( "check_unique_column" )

Where FormFu will create a new HTML::FormFu::Validator::Object  
instance and then call $object->validate_unique_column( $form,  
$new_value ) at the point of validation.

I think this makes sense because if validators are 'intended for  
higher-level validation, such as business-logic and database  
constraints such as "is this username unique?"' (quoted from pod),  
then the core validation logic should reside at the object model. But  
we'd be helping out with some basic methods that can be incorporated  
into DBIx::Class::HTML::FormFu.



UK: +44 (0)870 787 9243
US: +1 866 879 9184
Fax: +44 (0)845 280 1725
Skype: tonvoon

More information about the HTML-FormFu mailing list