/* date_form_validation.cgi #!/usr/local/bin/perl use strict; use DateFormValidation; my $webapp = DateFormValidation->new(); $webapp->run(); /* DateFormValidation.pm #!/usr/local/bin/perl # package DateFormValidation; use base CGI::Application; use CGI::Application::ValidateRM; use Data::Dumper; use strict; sub setup { my $self = shift; $self->tmpl_path('/home/appsys/www/htdocs/templates/'); $self->start_mode('form_display'); $self->run_modes ( 'form_display' => \&form_display, 'mode_0114' => \&form_process, ); } sub form_display { my $self = shift; my $errs = shift; my $t = $self->load_tmpl('app03/pr_businesshours_edit_test.html', die_on_bad_params => 0); $t->param($errs) if ref $errs; $t->param( intdow => 'Mon', inttype => 0, intstart => '00:00:00', intend => '00:00:00', intint => 30, dow => 0, providerid => 4, intervalid => 1, ); return $t->output; } sub form_process { my $self = shift; my $q = $self->query; my ($results, $err_page) = $self->check_rm('form_display', $self->_bh_profile ); print STDERR Dumper $results; #print STDERR $err_page; return $err_page if $err_page; # do something with $results->valid here. my $output = $q->start_html; $output .= "

Page appears to have validated
Start: " . $q->param('intstart') . " End: " . $q->param('intend'); return $output; } sub _bh_profile { return { required => [qw/intervalid/], optional => [qw/intstart intend intint/], filters => ['trim'], validator_packages => [qw(Data::FormValidator::Constraints::Dates)], constraints => { intstart => { name => 'date_and_time', constraint_method => 'date_and_time', params => [ \'hh:mm:ss' ], }, intend => { name => 'date_and_time', constraint_method => 'date_and_time', params => [ \'hh:mm:ss' ], }, }, msgs => { constraints => { 'date_and_time' => "Invalid time format", }, any_errors => 'err__', prefix => 'err_', }, }; } 1; /* The template

Provider ID:

Day Type
Start
End
Interval