1
package BookDB::Form::Book2PK;
2
use HTML::FormHandler::Moose;
3
extends 'HTML::FormHandler::Model::DBIC';
5
with 'HTML::FormHandler::Widget::Theme::Bootstrap';
9
Form object for the Book Controller
13
Form used for book/add and book/edit actions
21
has '+item_class' => ( default => 'Book2PK' );
23
has_field 'title' => (
26
required_message => 'A book must have a title.',
30
has_field 'publisher' => (
35
# has_many relationship pointing to mapping table
44
range_start => '1900',
49
has_field 'pages' => (
54
has_field submit => ( type => 'Submit', value => 'Update', element_class => ['btn'] );
57
my ( $self, $field ) = @_;
58
$field->add_error('Invalid year')
59
if ( ( $field->value > 3000 ) || ( $field->value < 1600 ) );
66
=head1 LICENSE AND COPYRIGHT
68
This module is free software; you can redistribute it and/or
69
modify it under the same terms as Perl itself. See L<perlartistic>.
73
__PACKAGE__->meta->make_immutable;
74
no HTML::FormHandler::Moose;