CGI::FormMagick::Validator

CGI::FormMagick::Validator is a Perl module that can validate data from FormMagick forms.
Download

CGI::FormMagick::Validator Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Kirrily Robert
  • Publisher web site:
  • http://search.cpan.org/~mitel/

CGI::FormMagick::Validator Tags


CGI::FormMagick::Validator Description

CGI::FormMagick::Validator is a Perl module that can validate data from FormMagick forms. CGI::FormMagick::Validator is a Perl module that can validate data from FormMagick forms.This module provides some common validation routines. Validation routines return the string "OK" if they succeed, or a descriptive message if they fail.Using more than one validation routine per fieldYou can use multiple validation routines like this: value="foo" validation="my_routine, my_other_routine"However, there are some requirements on formatting to make sure that FormMagick can parse what you've given it. * Parens are optional on subroutines with no args. my_routine is equivalent to my_routine(). * You MUST put a comma then a space between routine names, eg my_routine, my_other_routine NOT my_routine,my_other_routine. * You MUST NOT put a space between args to a routine, eg my_routine(1,2,3) NOT my_routine(1, 2, 3).This will be fixed to be more flexible in a later release.Making your own routinesFormMagick's validation routines may be overridden and others may be added on a per-application basis. To do this, simply define a subroutine in your CGI script that works in a similar way to the routines provided by CGI::FormMagick::Validator and use its name in the validation attribute in your XML.The arguments passed to the validation routine are the value of the field (to be validated) and any subsequent arguments given in the validation attribute. For example: value="foo" validation="my_routine" ===> my_routine(foo) value="foo" validation="my_routine(42)" ===> my_routine(foo, 42)The latter type of validation routine is useful for routines like minlength() and lengthrange() which come with CGI::FormMagick::Validator.Here's an example routine that you might write: sub my_grep { my $data = shift; my @list = @_; if (grep /$data/, @list) { return "OK" } else { return "That's not one of: @list" } } Requirements: · Perl


CGI::FormMagick::Validator Related Software