The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

HTML::Shakan::Field::Choice - choice field

SYNOPSIS

use HTML::Shakan::Field::Choice;
HTML::Shakan::Field::Choice->new(
    name => 'pref',
    choices => [
        #value=> label
        tokyo => 'tokyo',
        osaka => 'osaka',
        kyoto => 'kyoto',
    ],
);

# or shortcut
use HTML::Shakan::Fields;
ChoiceField(
    name => 'pref',
    choices => [
        tokyo => 'tokyo',
        osaka => 'osaka',
        kyoto => 'kyoto',
    ],
);

# if you want radio button
ChoiceField(
    name => 'pref',
    choices => [
        tokyo => 'tokyo',
        osaka => 'osaka',
        kyoto => 'kyoto',
    ],
    widget => 'radio',
);

# if you want checkbox
ChoiceField(
    name => 'pref',
    choices => [
        tokyo => 'tokyo',
        osaka => 'osaka',
        kyoto => 'kyoto',
    ],
    widget => 'checkbox',
);

DESCRIPTION

Choice field implementation. This field may show in HTML as <select></select> tag.

base class

HTML::Shakan::Field

SEE ALSO

HTML::Shakan