The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

HTML::Widget::Plugin::Radio - a widget for sets of radio buttons

SYNOPSIS

  $widget_factory->radio({
    name    => 'radio',
    value   => 'value_1',
    options => [
      [ value_1 => "Description 1" ],
      [ value_2 => "Description 2" ],
      [ value_2 => "Description 2", 'optional-elem-id' ],
    ],
  });

This will emit roughly:

  <input type='radio' name='radio' value='value_1' id='radio-value_1'
  checked='checked'></input>
  <label for='radio-value_1'>Description 2</label>

  <input type='radio' name='radio' value='value_2' id='radio-value_2'></input>
  <label for='radio-value_2'>Description 2</label>

  <input type='radio' name='radio' value='value_3'
  id='optional-elem-id'></input>
  <label for='optional-elem-id'>Description 2</label>

DESCRIPTION

This plugin provides a radio button-set widget

METHODS

provided_widgets

This plugin provides the following widgets: radio

radio

This method returns a set of radio buttons.

In addition to the generic HTML::Widget::Plugin attributes, the following are valid arguments:

disabled

If true, this option indicates that the select widget can't be changed by the user.

ignore_invalid

If this is given and true, an invalid value is ignored instead of throwing an exception.

options

This option must be a reference to an array of allowed values, each of which will get its own radio button.

value

If this argument is given, the option with this value will be pre-selected in the widget's initial state.

An exception will be thrown if more or less than one of the provided options has this value.

validate_value

This method checks whether the given value option is valid. See "radio" for an explanation of its default rules.

AUTHOR

Ricardo SIGNES <rjbs @ cpan.org>

COPYRIGHT

Copyright (C) 2005-2007, Ricardo SIGNES. This is free software, released under the same terms as perl itself.