Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
Form::Sensible::Field:UsereContributed Perl DoForm::Sensible::Field::Select(3)

NAME
       Form::Sensible::Field::Select - A multiple-choice option	field

SYNOPSIS
	   use Form::Sensible::Field::Select;

	   my $select_field = Form::Sensible::Field::Select->new(
								name =>	'bread_type'
								accepts_multiple => 1
							   );

	   $select_field->add_option('wheat', 'Wheat Bread');
	   $select_field->add_option('white', 'White Bread');
	   $select_field->add_option('sour', 'Sourdough	Bread');

	   $select_field->set_selection('sour',	'white');

DESCRIPTION
       This Field type allows a	user to	select one or more options from	a
       provided	set of options.	 This could be rendered	as a select box, a
       radio group or even a series of checkboxes, depending on	the renderer
       and the render hints provided.

ATTRIBUTES
       "accepts_multiple"
	       Flag for	if this	field allows multiple options to be selected.
	       Defaults	to false.  Note	that the value returned	by a select
	       field where 'accepts_multiple' is true will always be an
	       arrayref, even if only a	single option was selected.

       "options"
	       The options for the Select field	as an array ref. See
	       get_options().

METHODS
       "get_options()"
	       Returns an array	ref containing the allowed options. Each
	       option is represented as	a hash containing a "name" element and
	       a "value" element for the given option.

       "add_selection($selected_option,...)"
	       Adds the	provided option	values as selected.  If
	       "accepts_multiple" is true, the provided	options	will be	set IN
	       ADDITION	to any existing	selections.

       "set_selection($selected_option,...)"
	       Sets the	provided option	values as selected.  If
	       "accepts_multiple" is false, only the first item	will be	set as
	       selected.

       "add_option($option_value, $option_display_name)"
	       If an "options_delegate"	IS provided, has no effect whatsoever.
	       Otherwise it adds the provided value and	display	name to	the
	       set of options that can be selected for this field.

       "get_additional_configuration"
	       Returns the additional configuration attributes for this	Field
	       class as	a hashref.

DELEGATES
       "<options_delegate-"($self)>>
	       The "options_delegate" is called	to obtain the valid options
	       for this	field.	It is expected to return an array ref of
	       options.	Each option should be a	hash entry with	a "name" key
	       and a "value" key. If no	"options_delegate" is provided,
	       defaults	to delegating to itself, using internal	storage	of
	       options (using the "add_option" mechanism outlined above)

       "<values_ok_delegate-"($self, $values_arrayref)>>
	       The "values_ok_delegate"	is called to validate the values
	       selected	for the	field. It is passed an arrayref	containing the
	       selected	values and should return an array of error messages if
	       any of the values are invalid, or undef otherwise. If no
	       "values_ok_delegate" is provided, the default delegate simply
	       loops over the options returned by the "options_delegate" and
	       checks each value provided in turn. If retrieving options is an
	       expensive operation (say	pulling	from a DB table) it is often
	       less expensive to check the specific values provided rather
	       than pulling back all options and then comparing	them.  This
	       delegate	action provides	for that possibility.

AUTHOR
       Jay Kuri	- <jayk@cpan.org>

SPONSORED BY
       Ionzero LLC. <http://ionzero.com/>

SEE ALSO
       Form::Sensible

LICENSE
       Copyright 2009 by Jay Kuri <jayk@cpan.org>

       This library is free software; you can redistribute it and/or modify it
       under the same terms as Perl itself.

perl v5.32.0			  2012-02-02  Form::Sensible::Field::Select(3)

NAME | SYNOPSIS | DESCRIPTION | ATTRIBUTES | METHODS | DELEGATES | AUTHOR | SPONSORED BY | SEE ALSO | LICENSE

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=Form::Sensible::Field::Select&sektion=3&manpath=FreeBSD+12.2-RELEASE+and+Ports>

home | help