NAME
Data::HTML::Element::Input - Data object for HTML form element.
SYNOPSIS
use Data::HTML::Element::Input;
my $obj = Data::HTML::Element::Input->new(%params);
my $autofocus = $obj->autofocus;
my $checked = $obj->checked;
my $css_class = $obj->css_class;
my $disabled = $obj->disabled;
my $id = $obj->id;
my $label = $obj->label;
my $max = $obj->max;
my $min = $obj->min;
my $name = $obj->name;
my $placeholder = $obj->placeholder;
my $readonly = $obj->readonly;
my $required = $obj->required;
my $size = $obj->size;
my $value = $obj->value;
my $type = $obj->type;
METHODS
new
my $obj = Data::HTML::Element::Input->new(%params);
Constructor.
autofocus
Autofocus flag.
Default value is 0.
checked
Checked flag.
Default value is 0.
css_class
Form CSS class.
Default value is undef.
disabled
Disabled flag.
Default value is 0.
id
Form identifier.
Default value is undef.
label
Form label.
Default value is undef.
max
Input maximum value.
Default value is undef.
min
Input minimum value.
Default value is undef.
name
Input name.
Default value is undef.
placeholder
Input placeholder.
Default value is undef.
readonly
Readonly flag.
Default value is 0.
required
Required flag.
Default value is 0.
size
Input width in characters.
Default value is undef.
value
Input value.
Default value is undef.
type
Input type.
Possible value are:
button
checkbox
color
date
datetime-local
email
file
hidden
image
month
number
password
radio
range
reset
search
submit
tel
text
time
url
week
Returns instance of object.
autofocus
my $autofocus = $obj->autofocus;
Get input autofocus flag.
Returns bool value (1/0).
checked
my $checked = $obj->checked;
Get input checked flag.
Returns bool value (1/0).
css_class
my $css_class = $obj->css_class;
Get CSS class for form.
Returns string.
disabled
my $disabled = $obj->disabled;
Get input disabled flag.
Returns bool value (1/0).
id
my $id = $obj->id;
Get form identifier.
Returns string.
label
my $label = $obj->label;
Get form label.
Returns string.
max
my $max = $obj->max;
Get input max value.
Returns number.
min
my $min = $obj->min;
Get input min value.
Returns number.
name
my $name = $obj->name;
Get input name value.
Returns string.
placeholder
my $placeholder = $obj->placeholder;
Get input placeholder.
Returns string.
readonly
my $readonly = $obj->readonly;
Get input readonly flag.
Returns bool value (1/0).
required
my $required = $obj->required;
Get input required flag.
Returns bool value (1/0).
size
my $size = $obj->size;
Get input size.
Returns number.
value
my $value = $obj->value;
Get input value.
Returns string.
type
my $type = $obj->type;
Get input type.
Returns string.
ERRORS
new():
Parameter 'autofocus' must be a bool (0/1).
Value: %s
Parameter 'checked' must be a bool (0/1).
Value: %s
Parameter 'css_class' has bad CSS class name.
Value: %s
Parameter 'css_class' has bad CSS class name (number on begin).
Value: %s
Parameter 'disabled' must be a bool (0/1).
Value: %s
Parameter 'max' must be a number.
Value: %s
Parameter 'min' must be a number.
Value: %s
Parameter 'readonly' must be a bool (0/1).
Value: %s
Parameter 'required' must be a bool (0/1).
Value: %s
Parameter 'size' must be a number.
Value: %s
Parameter 'type' has bad value.
EXAMPLE
use strict;
use warnings;
use Data::HTML::Element::Input;
my $obj = Data::HTML::Element::Input->new(
'autofocus' => 1,
'css_class' => 'input',
'id' => 'address',
'label' => 'Customer address',
'placeholder' => 'Place address',
'type' => 'text',
);
# Print out.
print 'Id: '.$obj->id."\n";
print 'Type: '.$obj->type."\n";
print 'CSS class: '.$obj->css_class."\n";
print 'Label: '.$obj->label."\n";
print 'Autofocus: '.$obj->autofocus."\n";
print 'Placeholder: '.$obj->placeholder."\n";
# Output:
# Id: address
# Type: text
# CSS class: input
# Label: Customer address
# Autofocus: 1
# Placeholder: Place address
DEPENDENCIES
Error::Pure, List::Util, Mo, Mo::utils, Readonly.
REPOSITORY
https://github.com/michal-josef-spacek/Data-HTML-Element
AUTHOR
Michal Josef Špaček mailto:skim@cpan.org
LICENSE AND COPYRIGHT
© 2022-2024 Michal Josef Špaček
BSD 2-Clause License
VERSION
0.10