Rose::HTML::Form::Field::Hidden - Object representation of a hidden field in an HTML form.


Rose-HTML-Objects documentation Contained in the Rose-HTML-Objects distribution.

Index


Code Index:

NAME

Top

Rose::HTML::Form::Field::Hidden - Object representation of a hidden field in an HTML form.

SYNOPSIS

Top

    $field =
      Rose::HTML::Form::Field::Hidden->new(
        name  => 'code',  
        value => '1234');

    print $field->html;

    ...

DESCRIPTION

Top

Rose::HTML::Form::Field::Hidden is an object representation of a hidden field in an HTML form.

This class inherits from, and follows the conventions of, Rose::HTML::Form::Field. Inherited methods that are not overridden will not be documented a second time here. See the Rose::HTML::Form::Field documentation for more information.

HTML ATTRIBUTES

Top

Valid attributes:

    accept
    class
    dir
    id
    lang
    name
    style
    type
    value
    xml:lang

Required attributes (default values in parentheses):

    type (hidden)
    value

CONSTRUCTOR

Top

new PARAMS

Constructs a new Rose::HTML::Form::Field::Hidden object based on PARAMS, where PARAMS are name/value pairs. Any object method is a valid parameter name.

OBJECT METHODS

Top

error

This method is a no-op.

has_error

Returns false.

AUTHOR

Top

John C. Siracusa (siracusa@gmail.com)

LICENSE

Top

Copyright (c) 2010 by John C. Siracusa. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


Rose-HTML-Objects documentation Contained in the Rose-HTML-Objects distribution.

package Rose::HTML::Form::Field::Hidden;

use strict;

use base 'Rose::HTML::Form::Field::Input';

our $VERSION = '0.606';

__PACKAGE__->delete_valid_html_attrs(qw(disabled ismap usemap alt src tabindex
checked maxlength onblur onchange onclick ondblclick onfocus onkeydown
onkeypress onkeyup onmousedown onmousemove onmouseout onmouseover onmouseup
onselect readonly size title accesskey));

__PACKAGE__->add_required_html_attrs('value');
__PACKAGE__->required_html_attr_value(type => 'hidden');

sub hidden_fields       { (wantarray) ? shift : [ shift ] }
sub html_hidden_fields  { (wantarray) ? shift->html_field : [ shift->html_field ] }
sub xhtml_hidden_fields { (wantarray) ? shift->xhtml_field : [ shift->xhtml_field ] }

sub clear      {   }
sub error      {   }
sub errors     {   }
sub has_error  { 0 }
sub has_errors { 0 }
sub validate   { 1 }

sub html_field
{
  my($self) = shift;
  $self->html_attr(value => $self->output_value);
  return $self->SUPER::html_field(@_);
}

sub xhtml_field
{
  my($self) = shift;
  $self->html_attr(value => $self->output_value);
  return $self->SUPER::xhtml_field(@_);
}

1;

__END__