NAME

HTML::FormBuilder::Field - Field container used by HTML::FormBuilder

SYNOPSIS

my $form = HTML::FormBuilder->new(data => {id => 'testform});

my $fieldset = $form->add_fieldset({id => 'fieldset1'});

$fieldset->add_field({input => {type => 'text', value => 'Join'}});

# Text only, without input fields
$fieldset->add_field({
    comment => {
        text        => 'Please check on checkbox below:',
        class       => 'grd-grid-12',
        # no extra <br/> before <span> for comment
        no_new_line => 1,
    },
});

# checkbox & explanation text
$fieldset->add_field({
    input => {
        id                  => 'tnc',
        name                => 'tnc',
        type                => 'checkbox',
        trailing            => 'I have read & agree to all terms & condition.',
        # wrap <input> & trailing <span> respectively in <div>, with class:
        wrap_in_div_class   => {
            input    => 'grd-grid-1',
            trailing => 'grd-grid-11'
        },
    },
    error => {
        id    => 'error_tnc',
        class => 'errorfield',
     },
    validation => [{
        type    => 'checkbox_checked',
        err_msg => localize('Please agree in order to proceed.'),
    }],
    # override div container class for input
    override_input_class => 'grd-grid-12',
});

$form->add_field($fieldset_index, {input => {type => 'text', value => 'Join'}});

METHODS

BUILDARGS

build

data

AUTHOR

Chylli mailto:chylli@binary.com

INHERITED METHODS

HTML::FormBuilder::Base

classes, localize

Moo::Object

BUILDALL, DEMOLISHALL, does, meta

CONTRIBUTOR

Fayland Lam mailto:fayland@binary.com

Tee Shuwn Yuan mailto:shuwnyuan@binary.com

COPYRIGHT AND LICENSE