NAME
Data::HTML::Element::Input - Data object for HTML input 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 $onclick = $obj->onclick;
my $placeholder = $obj->placeholder;
my $readonly = $obj->readonly;
my $required = $obj->required;
my $size = $obj->size;
my $step = $obj->step;
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
Input CSS class.
Default value is undef.
disabled
Disabled flag.
Default value is 0.
id
Input identifier.
Default value is undef.
label
Input 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.
onclick
OnClick code.
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.
step
Input step.
Value is number or 'any' string.
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 input.
Returns string.
disabled
my $disabled = $obj->disabled;
Get input disabled flag.
Returns bool value (1/0).
id
my $id = $obj->id;
Get input identifier.
Returns string.
label
my $label = $obj->label;
Get input 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.
onclick
my $onclick = $obj->onclick;
Get OnClick code.
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.
step
my $step = $obj->step;
Get input step.
Returns number of 'any' string.
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 'step' is not valid for defined type.
Type: %s
Parameter 'step' must be a number or 'any' string.
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, Mo::utils::CSS, Readonly, Scalar::Util.
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.17