Debian Codegraph @

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

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