Skip to content

classes_lib_controls_form_select.class

Daniel Spors edited this page Dec 19, 2023 · 3 revisions

Classes in file lib/controls/form/select.class.php

class Select

Represents a select element.

Extends: Control » Renderable

Subclasses: CurrencyFormatSelect, CurrencySelect, DateTimeFormatSelect, LanguageSelect, RegionSelect, Select2, TimezoneSelect

AddGroup

Creates an optgroup element.

Definition: public function AddGroup($label, $disabled=false)

Returns: static

Parameters:

  • string $label The label text

  • bool $disabled True if disabled

AddOption

Creates an option element.

Definition: public function AddOption($value, $label, $selected=false, $opt_group=false)

Returns: static

Parameters:

  • mixed $value The value

  • mixed $label An optional label

  • bool $selected True if selected (hint: use Select::SetCurrentValue instead of evaluating selected state for each option)

  • Control $opt_group If given the option will be added to this optgroup element. Create one via Select::CreateGroup.

Create

DEPRECATED (2022/07) Use Make and method-chaining instead Created and return a Select control.

CreateGroup

Creates an optgroup element and returns it. Same as Select::AddGroup, but return the OptGroup Control instead to $this.

Definition: public function CreateGroup($label, $disabled=false)

Returns: Control OptGroup element

Parameters:

  • string $label The label text

  • bool $disabled True if disabled

CreateLabel

Creates a label element for this select. Note that this only ensures that the label is correctly assigned to this select. It will not add it somewhere!

Definition: public function CreateLabel($text)

Returns: Label The created label element

Parameters:

  • string $text Text for the label

CreateOption

Creates an option and returns it.

Definition: public function CreateOption($value, $label, $selected=false, $opt_group=false)

Returns: Control The created option

Parameters:

  • mixed $value The value

  • mixed $label An optional label

  • bool $selected True if selected (hint: use Select::SetCurrentValue instead of evaluating selected state for each option)

  • Control $opt_group If given the option will be added to this optgroup element. Create one via Select::CreateGroup.

setAutoSubmit

Enables form auto-submission on value change. This is done by submitting $(this).closest('form')

Definition: public function setAutoSubmit($on=true)

Returns: static

Parameters:

  • bool $on if true, activates, else stops

SetCurrentValue

DEPRECATED (2021/03) Use Select::setValue instead

setName

Sets the name attribute.

Definition: public function setName($name)

Returns: static

Parameters:

  • string $name The type

setValue

Sets the value attribute.

Definition: public function setValue($value)

Returns: static

Parameters:

  • string $value The value

_setval

Set the option(s) as selected after the options have been added

Definition: private function _setval($children, $val)

Returns: NOT DOCUMENTED

Parameters:

  • $children NOT DOCUMENTED

  • $val NOT DOCUMENTED

__construct

Definition: public function __construct($name=false)

Returns: NOT DOCUMENTED

Parameters:

  • string $name The name
Clone this wiki locally