1HTML::FormHandler::FielUds:e:rDiCsopnltaryi(b3u)ted PerlHTDMoLc:u:mFeonrtmaHtainodnler::Field::Display(3)
2
3
4
6 HTML::FormHandler::Field::Display - display only field
7
9 version 0.40068
10
12 This class can be used for fields that are display only. It will render
13 the value returned by a form's 'html_<field_name>' method, or the
14 field's 'html' attribute.
15
16 has_field 'explanation' => ( type => 'Display',
17 html => '<p>This is an explanation...</p>' );
18
19 or in a form:
20
21 has_field 'explanation' => ( type => 'Display' );
22 sub html_explanation {
23 my ( $self, $field ) = @_;
24 if( $self->something ) {
25 return '<p>This type of explanation...</p>';
26 }
27 else {
28 return '<p>Another type of explanation...</p>';
29 }
30 }
31 #----
32 has_field 'username' => ( type => 'Display' );
33 sub html_username {
34 my ( $self, $field ) = @_;
35 return '<div><b>User: </b>' . $field->value . '</div>';
36 }
37
38 or set the name of the rendering method:
39
40 has_field 'explanation' => ( type => 'Display', set_html => 'my_explanation' );
41 sub my_explanation {
42 ....
43 }
44
45 or provide a 'render_method':
46
47 has_field 'my_button' => ( type => 'Display', render_method => \&render_my_button );
48 sub render_my_button {
49 my $self = shift;
50 ....
51 return '...';
52 }
53
55 FormHandler Contributors - see HTML::FormHandler
56
58 This software is copyright (c) 2017 by Gerda Shank.
59
60 This is free software; you can redistribute it and/or modify it under
61 the same terms as the Perl 5 programming language system itself.
62
63
64
65perl v5.32.0 2020-07-2H8TML::FormHandler::Field::Display(3)