InputfieldSelectMultiple

Multiple selection via <select multiple>

Extends InputfieldSelect — all option management, querying, and attribute methods are inherited. Returns an array value.

$f = $modules->get('InputfieldSelectMultiple');
$f->name = 'colors';
$f->label = 'Favorite colors';
$f->addOptions(['red' => 'Red', 'green' => 'Green', 'blue' => 'Blue']);
$f->val(['red', 'blue']); // pre-select multiple values
$form->add($f);

See InputfieldSelect for options management. See Inputfield for the shared Inputfield API (labels, collapsed states, showIf, rendering, processing, etc.).

Properties
PropertyTypeDefaultDescription
sizeint10Number of visible rows in the select box
Constants
ConstantValueDescription
defaultSize10Default number of visible rows
Notes
  • Value is always an array. Use $f->val(['a', 'b']) to set multiple selections.
  • Blank options are silently ignored — multi-select has no concept of a "blank" selection.
  • Implements InputfieldHasArrayValue. After processInput(), $f->val() returns an array of selected values.
  • Source file: wire/modules/Inputfield/InputfieldSelectMultiple.module
API reference: methods, properties, hooks

An Inputfield for handling multiple selection using HTML <select multiple>. Also a base type for other multiple selection types (checkboxes, asmSelect, etc.)


Click any linked item for full usage details and examples. Hookable methods are indicated with the icon. In addition to those shown below, the InputfieldSelectMultiple class also inherits all the methods and properties of: InputfieldSelect, Inputfield, WireData and Wire.

Show class?     Show args?       Only hookable?    

Properties

NameReturnSummary 
InputfieldSelectMultiple::size int 

Additional methods and properties

In addition to the methods and properties above, InputfieldSelectMultiple also inherits the methods and properties of these classes:

API reference based on ProcessWire core version 3.0.268