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.).
| Property | Type | Default | Description |
|---|---|---|---|
size | int | 10 | Number of visible rows in the select box |
| Constant | Value | Description |
|---|---|---|
defaultSize | 10 | Default number of visible rows |
- 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. AfterprocessInput(),$f->val()returns an array of selected values. - Source file:
wire/modules/Inputfield/InputfieldSelect Multiple.module
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 Inputfield class also inherits all the methods and properties of: InputfieldSelect, Inputfield, WireData and Wire.
Common
Properties
| Name | Return | Summary | |
|---|---|---|---|
| Inputfield | int |
Additional methods and properties
In addition to the methods and properties above, Inputfield
API reference based on ProcessWire core version 3.0.268