NAME
HTML::Shakan::Model::DataModel - Data::Model bindings for Shakan
SYNOPSIS
# in edit form
my $form = HTML::Shakan->new(
model => 'DataModel'
);
my $row = $dm->lookup('any_table', 1);
if ($form->submitted_and_valid) {
$form->model->update( $row );
redirect('/to/anywhere');
} else {
$form->model->fill( $row );
render_template({form => $form, row => $row});
}
# add form
my $form = HTML::Shakan->new(
model => 'DataModel'
);
if ($form->submitted_and_valid) {
$form->model->create( $model, 'user' );
redirect('/to/anywhere');
} else {
$form->model->fill( $row );
render_template({form => $form, row => $row});
}
DESCRIPTION
wrapper class for Data::Model & HTML::Shakan
METHODS
- $form->model->fill($row)
-
fill this row to form
- $form->model->create($model => $name);
-
insert new row.
- $form->model->update($row);
-
update this row