| 1 |
package HTML::FormHandler::Field::NoValue; |
| 2 |
# ABSTRACT: base class for submit field |
| 3 |
$HTML::FormHandler::Field::NoValue::VERSION = '0.410002'; |
| 4 |
use Moose; |
| 5 |
extends 'HTML::FormHandler::Field'; |
| 6 |
|
| 7 |
|
| 8 |
has 'html' => ( is => 'rw', isa => 'Str', default => '' ); |
| 9 |
has 'value' => ( |
| 10 |
is => 'rw', |
| 11 |
predicate => 'has_value', |
| 12 |
clearer => 'clear_value', |
| 13 |
); |
| 14 |
|
| 15 |
sub _result_from_fields { |
| 16 |
my ( $self, $result ) = @_; |
| 17 |
my $value = $self->get_default_value; |
| 18 |
if ( $value ) { |
| 19 |
$self->value($value); |
| 20 |
} |
| 21 |
$self->_set_result($result); |
| 22 |
$result->_set_field_def($self); |
| 23 |
return $result; |
| 24 |
} |
| 25 |
|
| 26 |
sub _result_from_input { |
| 27 |
my ( $self, $result, $input, $exists ) = @_; |
| 28 |
$self->_set_result($result); |
| 29 |
$result->_set_field_def($self); |
| 30 |
return $result; |
| 31 |
} |
| 32 |
|
| 33 |
sub _result_from_object { |
| 34 |
my ( $self, $result, $value ) = @_; |
| 35 |
$self->_set_result($result); |
| 36 |
$result->_set_field_def($self); |
| 37 |
return $result; |
| 38 |
} |
| 39 |
|
| 40 |
sub fif { } |
| 41 |
|
| 42 |
has '+widget' => ( default => '' ); |
| 43 |
has '+noupdate' => ( default => 1 ); |
| 44 |
|
| 45 |
sub validate_field { } |
| 46 |
|
| 47 |
#sub clear_value { } |
| 48 |
|
| 49 |
sub render { |
| 50 |
my $self = shift; |
| 51 |
return $self->html; |
| 52 |
} |
| 53 |
|
| 54 |
__PACKAGE__->meta->make_immutable; |
| 55 |
use namespace::autoclean; |
| 56 |
1; |
| 57 |
|
| 58 |
__END__ |
| 59 |
|
| 60 |
=pod |
| 61 |
|
| 62 |
=encoding UTF-8 |
| 63 |
|
| 64 |
=head1 NAME |
| 65 |
|
| 66 |
HTML::FormHandler::Field::NoValue - base class for submit field |
| 67 |
|
| 68 |
=head1 VERSION |
| 69 |
|
| 70 |
version 0.410002 |
| 71 |
|
| 72 |
=head1 SYNOPSIS |
| 73 |
|
| 74 |
This is the base class for the Submit & Reset fields. It can be used for fields that |
| 75 |
do not produce valid 'values'. It should not be used for fields that |
| 76 |
produce a value or need validating. |
| 77 |
|
| 78 |
=head1 AUTHOR |
| 79 |
|
| 80 |
FormHandler Contributors - see HTML::FormHandler |
| 81 |
|
| 82 |
=head1 COPYRIGHT AND LICENSE |
| 83 |
|
| 84 |
This software is copyright (c) 2017 by Gerda Shank. |
| 85 |
|
| 86 |
This is free software; you can redistribute it and/or modify it under |
| 87 |
the same terms as the Perl 5 programming language system itself. |
| 88 |
|
| 89 |
=cut |