2009/8/15 Steve Rippl <rip...@woodlandschools.org>: > Lastly, is it possible to and/or constraints? i.e. "value in range 1-5 || > value in range 10-20" etc.
Hi Steve, I'd generally create a new constraint class, so it can be loaded via config files, as I avoid putting any form generation code in my Controller classes. As you're already using code to create your forms, though, you could do this: $element->constraint( { type => 'Callback', callback => sub { my $value = shift; return( ( $value >= 1 && $value <= 5 ) || ( $value >= 10 && $value <= 20 ) ); }, } ); Or, if you want to use the same constraint more than once: sub in_range { my $value = shift; return( ( $value >= 1 && $value <= 5 ) || ( $value >= 10 && $value <= 20 ) ); }; $element->constraint( { type => 'Callback', callback => \&in_range, }); Carl _______________________________________________ HTML-FormFu mailing list HTML-FormFu@lists.scsys.co.uk http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu