Robert Hicks wrote:
I am trying out the ValidateRM plugin. I have it working with one form which is cool.The second form I have deals with hours worked on a project. The hours are put in by increments of .25 (i.e. it could be .50 or 7.75). I know I can check this with the mod ( % ) operator but I haven't a clue on how to make that a constraint for the "total_hours" field to make sure the user is putting in a valid number.
My knee-jerk reaction is a customized subroutine to check that:
my $validation_profile = {
'constraints' => {
total_hours => {
constraint => 'is_quarter_hour'
},
},
};
sub is_quarter_hour {
my $result = 0;
my $data = shift;
if ( $data % .25 ) {
$result = 1;
}
return $result;
}
(Note: This is untested/unoptimized proof-of-concept code)
I see there's a new version of DFV that has a constraint_methods
property that may also do this trick, but I'm not up-to-date on that
technique.
BTW, There's a mailing list just for DFV:
http://lists.sourceforge.net/lists/listinfo/cascade-dataform
- Jason
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/suppressed/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.