Hi,
I'm trying to expand my knowlege of C::A by finally incorporating some
of the great sub modules into my applications..
I"m writing a piece of software for booking swimming pool maintanence..
Here is my runmode that actually takes the data, validates it, and
saves the data..
sub bookPool_do {
my ($self) = @_;
my $q = $self->query();
my $dbh = $self->param('dbh');
my ($results,$err_page) = $self->check_rm('poolcheck::bookPool', {
required => [qw/fullname address primaryphone/],
optional => [qw/secondaryphone pooltype coveroff accessby/],
constraints => {zipcode => 'zip',
primaryphone => 'american_phone',
secondaryphone => 'american_phone',
},
filters => ['trim'],
msgs => {any_errors => 'err__',
prefix=>'err_',
},
});
return $err_page if $err_page;
# if we got to this point, we have valid input, so we should insert it.
my $bookid = _bookPool_do($q->param('bookid'), yada yada);
if (!$bookid) {
show error here !
} else {
display success page.
}
}
ValidateRM works great for validating the form, but I'm looking for an
effecient way to display errors if the actual INSERT failed [ie
_bookPool_do]. If that returns a 0 what i typically do is return the
runmode that drew the page, display the error and fill in all the
fields that the user had filled in.
Since ValidateRM already re-fills in the form in case of an error I
did not write the code i'd typically write to do that step. Does
anyone have any elegant ideas that i could use without writing the by
hand code to refill those entries ?
I'm going to try HTML::Fillinform, unless ya'll have any better idea's.
THanks.
--
Jeff MacDonald
http://www.halifaxbudolife.ca
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/[email protected]/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]