NAME

Tags::HTML::Element::Select - Tags helper for HTML select element.

SYNOPSIS

use Tags::HTML::Element::Select;

my $obj = Tags::HTML::Element::Select->new(%params);
$obj->process($select);
$obj->process_css($select);

METHODS

new

my $obj = Tags::HTML::Element::Select->new(%params);

Constructor.

  • css

    'CSS::Struct::Output' object for process_css processing.

    Default value is undef.

  • tags

    'Tags::Output' object.

    Default value is undef.

process

$obj->process($select);

Process Tags structure for $select data object to output.

Accepted $select is Data::HTML::Element::Select.

Returns undef.

process_css

$obj->process_css($select);

Process CSS::Struct structure for $select data object to output.

Accepted $select is Data::HTML::Element::Select.

Returns undef.

ERRORS

new():
        From Tags::HTML::new():
                Parameter 'css' must be a 'CSS::Struct::Output::*' class.
                Parameter 'tags' must be a 'Tags::Output::*' class.

process():
        From Tags::HTML::process():
                Parameter 'tags' isn't defined.
        Input object must be a 'Data::HTML::Element::Select' instance.

process_css():
        From Tags::HTML::process_css():
                Parameter 'css' isn't defined.
        Input object must be a 'Data::HTML::Element::Select' instance.

EXAMPLE

use strict;
use warnings;

use CSS::Struct::Output::Indent;
use Data::HTML::Element::Select;
use Tags::HTML::Element::Select;
use Tags::Output::Indent;

# Object.
my $css = CSS::Struct::Output::Indent->new;
my $tags = Tags::Output::Indent->new(
        'xml' => 1,
);
my $obj = Tags::HTML::Element::Select->new(
        'css' => $css,
        'tags' => $tags,
);

# Data object for select.
my $select = Data::HTML::Element::Select->new(
        'css_class' => 'form-select',
);

# Process select.
$obj->process($select);
$obj->process_css($select);

# Print out.
print "HTML:\n";
print $tags->flush;
print "\n\n";
print "CSS:\n";
print $css->flush;

# Output:
# HTML:
# <select class="form-select" type="text" />
#
# CSS:
# select.form-select {
#         width: 100%;
#         padding: 12px 20px;
#         margin: 8px 0;
#         display: inline-block;
#         border: 1px solid #ccc;
#         border-radius: 4px;
#         box-sizing: border-box;
# }

DEPENDENCIES

Class::Utils, Error::Pure, Scalar::Util, Tags::HTML, Tags::HTML::Element::Option.

REPOSITORY

https://github.com/michal-josef-spacek/Tags-HTML-Element

AUTHOR

Michal Josef Špaček mailto:skim@cpan.org

http://skim.cz

LICENSE AND COPYRIGHT

© 2022-2023 Michal Josef Špaček

BSD 2-Clause License

VERSION

0.01