[dfv] Named Constraints supported?
Status: Inactive
Brought to you by:
markjugg
|
From: Matt <ma...@cp...> - 2011-03-23 14:47:27
|
Hi All,
I've been working on putting together a somewhat simple on-the-fly DFV
profile generator, but have hit a bit of a roadblock.
I am trying to attach multiple constraints to a given field with a
profile like so :
{
constraint_methods => {
username => [
sub { ... },
sub { ... },
qr/^\W+$/,
{ constraint => qr/^\W+$/, name => "username_valid" },
{ constraint => sub { ... }, name => "username_length" },
{ constraint => sub { ... }, name => "username_taken" },
],
},
required => "username",
}
Based on the documentation here:
http://search.cpan.org/~markstos/Data-FormValidator-4.66/lib/Data/FormValidator.pm#MULTIPLE_CONSTRAINTS
I am led to believe this should be possible.. but I'm catching the
following error:
[error] Caught exception in SalesLink::Controller::Form->field "Value
for constraint_method within hashref ''
not a code reference or Regexp . Do you need func(), not 'func'?
at
/home/matt/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/Data/FormValidator.pm
line 974."
Based on looking at D::FV's source it seems like this functionality is
no longer supported, but I'd just like to confirm.
Does anyone have any suggestions for approaching this issue?
Cheers,
Matt
|