hello all,
Currently we use D::FV (with C::A::P::VRM) with msgs such that an error
msgs named 'err_foo' will be passed into the templates. Basically like this:
sub show_stuff {
my ($self, $error_msgs) = @_;
my $tmpl = $self->load_tmpl(...);
if( $error_msgs ) {
$tmpl->param(%$error_msgs);
}
return $tmpl->output();
}
sub do_stuff {
my $self = shift;
my $profile = {
required => [qw(foo blah)],
constraints => {
foo => qr/_foo$/,
},
msgs => {
prefix => 'err_',
any_errors => 'any_errors',
format => '%s',
missing => 1,
invalid => 1,
invalid_seperator => '',
},
};
This allows me to put the complete error message in the template and for
the 'err_foo' param to just be a flag (with a value of 1). This works
exactly like I want it to, but If I try to add multiple constraints on
the same value like so:
constraints => {
blah => [
{
name => 'ends_in_blah',
constraint => qr/blah$/,
},
{
name => 'begins_with_blah',
constraint => qr/^blah/,
}
],
},
I would like to get not only a flag named 'err_blah' but also a flag
named 'err_ends_in_blah' and/or 'err_begins_with_blah' so that my error
messages in my template can do the right thing based on which of the
multiple constraints failed. Is this a reasonable request? Is there a
workaround or another way to accomplish this?
--
Michael Peters
Developer
Plus Three, LP
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/[email protected]/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]