HTML::FormHandler::Field::Display(3pm)

HTML::FormHandler::Field::Display3pm

Display only field

Usage

This class can be used for fields that are display only. It will render the value returned by a form's 'html_<field_name>' method, or the field's 'html' attribute.

  has_field 'explanation' => ( type => 'Display',
     html => '<p>This is an explanation...</p>' );

or in a form:

  has_field 'explanation' => ( type => 'Display' );
  sub html_explanation {
     my ( $self, $field ) = @_;
     if( $self->something ) {
        return '<p>This type of explanation...</p>';
     }
     else {
        return '<p>Another type of explanation...</p>';
     }
  }
  #----
  has_field 'username' => ( type => 'Display' );
  sub html_username {
      my ( $self, $field ) = @_;
      return '<div><b>User:&nbsp;</b>' . $field->value . '</div>';
  }

or set the name of the rendering method:

   has_field 'explanation' => ( type => 'Display', set_html => 'my_explanation' );
   sub my_explanation {
     ....
   }

or provide a 'render_method':

   has_field 'my_button' => ( type => 'Display', render_method => \&render_my_button );
   sub render_my_button {
       my $self = shift;
       ....
       return '...';
   }

Version

version 0.40068

Releases

7 releases since Debian 7 (Wheezy); the text changed 4 times.

  1. 7
  2. 8
  3. 9
  4. 10–11
  5. 12–13

Author

FormHandler Contributors - see HTML::FormHandler

From libhtml-formhandler-perl 0.40068-2 in Debian 13 (Trixie). Parsed by carta from the page's man source.