CGI::Ex::ValidateCGI::Ex::Validate is the "Just Right" form validator with javascript in parallel. | |
Download |
CGI::Ex::Validate Ranking & Summary
Advertisement
- License:
- Perl Artistic License
- Price:
- FREE
- Publisher Name:
- Paul Seamons
- Publisher web site:
- http://search.cpan.org/~rhandom/
CGI::Ex::Validate Tags
CGI::Ex::Validate Description
CGI::Ex::Validate is the "Just Right" form validator with javascript in parallel. CGI::Ex::Validate is the "Just Right" form validator with javascript in parallel.SYNOPSIS use CGI::Ex::Validate; ### THE SHORT my $errobj = CGI::Ex::Validate->new->validate($form, $val_hash); ### THE LONG my $form = CGI->new; # OR # my $form = CGI::Ex->new; # OR CGI::Ex->get_form; # OR # my $form = {key1 => 'val1', key2 => 'val2'}; ### simplest my $val_hash = { username => { required => 1, max_len => 30, field => 'username', # field is optional in this case - will use key name }, email => { required => 1, max_len => 100, type => 'email', }, email2 => { equals => 'email', }, }; ### ordered (only onevent submit needs order) my $val_hash = { 'group order' => , username => {required => 1, max_len => 30}, email => ..., email2 => ..., }; ### ordered again my $val_hash = { 'group fields' => , }; my $vob = CGI::Ex::Validate->new; my $errobj = $vob->validate($form, $val_hash); # OR # # import config using any type CGI::Ex::Conf supports my $errobj = $vob->validate($form, "/somefile/somewhere.val"); if ($errobj) { my $error_heading = $errobj->as_string; # OR "$errobj"; my $error_list = $errobj->as_array; # ordered list of what when wrong my $error_hash = $errobj->as_hash; # hash of arrayrefs of errors } else { # the form passed validation } ### will add an error for any form key not found in $val_hash my $vob = CGI::Ex::Validate->new({no_extra_keys => 1}); my $errobj = $vob->validate($form, $val_hash); my $js_uri_path = '/js/'; # static or dynamic URI path to find CGI/Ex/validate.js my $form_name = "the_form"; # name of the form to attach javascript to my $javascript = $vob->generate_js($val_hash, $form_name, $js_uri_path); Requirements: · Perl
CGI::Ex::Validate Related Software