Debian Codegraph @

lib/HTML/FormHandler/Widget/Field/Textarea.pm

raw
1 package HTML::FormHandler::Widget::Field::Textarea;
2 # ABSTRACT: textarea rendering widget
3 $HTML::FormHandler::Widget::Field::Textarea::VERSION = '0.410002';
4 use Moose::Role;
5 use namespace::autoclean;
6 use HTML::FormHandler::Render::Util ('process_attrs');
7
8 sub render_element {
9 my $self = shift;
10 my $result = shift || $self->result;
11
12 my $fif = $self->html_filter($result->fif);
13 my $id = $self->id;
14 my $cols = $self->cols || 10;
15 my $rows = $self->rows || 5;
16 my $name = $self->html_name;
17 my $output =
18 qq(<textarea name="$name" id="$id")
19 . process_attrs($self->element_attributes($result))
20 . qq( rows="$rows" cols="$cols">$fif</textarea>);
21 return $output;
22 }
23
24 sub render {
25 my ( $self, $result ) = @_;
26 $result ||= $self->result;
27 die "No result for form field '" . $self->full_name . "'. Field may be inactive." unless $result;
28 my $output = $self->render_element( $result );
29 return $self->wrap_field( $result, $output );
30 }
31
32 1;
33
34 __END__
35
36 =pod
37
38 =encoding UTF-8
39
40 =head1 NAME
41
42 HTML::FormHandler::Widget::Field::Textarea - textarea rendering widget
43
44 =head1 VERSION
45
46 version 0.410002
47
48 =head1 AUTHOR
49
50 FormHandler Contributors - see HTML::FormHandler
51
52 =head1 COPYRIGHT AND LICENSE
53
54 This software is copyright (c) 2017 by Gerda Shank.
55
56 This is free software; you can redistribute it and/or modify it under
57 the same terms as the Perl 5 programming language system itself.
58
59 =cut