I really appreciate everybody's input on this!! In
case they may be interesting or helpful, I'm reposting
my setup() method as it now stands, and my Create
run_mode. The latter is at a high level, calling
other methods which might be shared by other crud/run
modes. Comments will be welcome.
Thanks!!
#
sub setup
{
my $self = shift;
$self->param('debug' => 0); #To dump app. state if
evaluates true
#Permissible run modes passed via cgi/html submit
button name
#CRUD is acronym for create, read, update, delete
$self->param('buttons' => ['Create', 'Read',
'Update', 'Delete']);
$self->runModePerButton();
#Run mode if no correspondingly named CGI submit
parameter
$self->run_modes('Abort' => \&Abort);
my $cgi = $self->query();
my $defaultMode = 'Create';
my $crudMode = $defaultMode unless $cgi->param();
#Default for first invoke
$crudMode = $self->getSubmittedCrud() if
$cgi->param();
$crudMode = 'Abort' unless $crudMode;
#Since crud mode can change use mode_param's
callback instead of hardcoding
my $crudCall = sub {return $crudMode};
$self->mode_param($crudCall);
#Hash of hashes, for database, hidden field,
navigation buttons, etc.
#Also template information, including setting the
tmpl_path
$self->param('appDefs' => $self->autoDefine());
#Additional custom parameters
$self->param('caption' => 'RWMC Nicotine Dependence
Program');
$self->param('crudMode' => $crudMode);
}
#
#
sub Create
{
my $self = shift;
my $templateHeader = $self->commitDataOrRedisplay();
$self->recalculateTemplate() unless
$self->param('redisplayTemplate');
my $output = $templateHeader .
$self->beginTemplateForm();
my $htmlTemplate = $self->prepareTemplate();
$output .= $htmlTemplate->output() .
$self->putButtons();
return $output;
}
#
=====
George M. Jempty
Database Admin/Intranet Architect
Regional West Medical Center
Scottsbluff, Nebraska
[EMAIL PROTECTED][EMAIL PROTECTED]
__________________________________________________
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]