Dropdown of values in an array
static public showFromArray ( $name, array $elements, $options = [] ) | ||
$name | select name | |
$elements | array | array of elements to display |
$options | array of possible options: - value : integer / preselected value (default 0) - used : array / Already used items ID: not to display in dropdown (default empty) - readonly : boolean / used as a readonly item (default false) - on_change : string / value to transmit to "onChange" - multiple : boolean / can select several values (default false) - size : integer / number of rows for the select (default = 1) - display : boolean / display or return string - other : boolean or string if not false, then we can use an "other" value if it is a string, then the default value will be this string - rand : specific rand if needed (default is generated one) - width : specific width needed (default not set) - emptylabel : empty label if empty displayed (default self::EMPTY_VALUE) - display_emptychoice : display empty choice (default false) - tooltip : string / message to add as tooltip on the dropdown (default '') - option_tooltips : array / message to add as tooltip on the dropdown options. Use the same keys as for the $elements parameter, but none is mandotary. Missing keys will just be ignored and no tooltip will be added. To add a tooltip on an option group, is the '__optgroup_label' key inside the array describing option tooltips : 'optgroupname1' => array('__optgroup_label' => 'tooltip for option group') (default empty) Permit to use optgroup defining items in arrays array('optgroupname' => array('key1' => 'val1', 'key2' => 'val2'), 'optgroupname2' => array('key3' => 'val3', 'key4' => 'val4')) |