JHtmlSelect

Utility class for creating HTML select lists

abstract
package

Joomla.Platform

subpackage

HTML

since

11.1

Methods

booleanlist

Generates a yes/no radio list.

booleanlist(string $name, array $attribs = null, string $selected = null, string $yes = 'JYES', string $no = 'JNO', string $id = false) : string
static
since

11.1

see \JFormFieldRadio

Arguments

$name

stringThe value of the HTML name attribute

$attribs

arrayAdditional HTML attributes for the tag. This can be an array of attributes, or an array of options. Treated as options if it is the last argument passed. Valid options are: Format options, see {@see JHtml::$formatOptions}. Selection options, see {@see JHtmlSelect::options()}. list.attr, string|array: Additional attributes for the select element. id, string: Value to use as the select element id attribute. Defaults to the same as the name. list.select, string|array: Identifies one or more option elements to be selected, based on the option key values.

$optKey

stringThe name of the object variable for the option value. If set to null, the index of the value array is used.

$optText

stringThe name of the object variable for the option text.

$selected

mixedThe key that is selected (accepts an array or a string).

$idtag

mixedValue of the field id or null by default

$translate

booleanTrue to translate

Response

stringHTML for the select list.

groupedlist

Generates a grouped HTML selection list from nested arrays.

groupedlist(array $data, string $name, array $options = array()) : string
static
since

11.1

throws

\JExceptionIf a group has unprocessable contents.

Arguments

$data

arrayAn array of groups, each of which is an array of options.

$name

stringThe value of the HTML name attribute

$options

arrayOptions, an array of key/value pairs. Valid options are: Format options, {@see JHtml::$formatOptions}. Selection options. See {@see JHtmlSelect::options()}. group.id: The property in each group to use as the group id attribute. Defaults to none. group.label: The property in each group to use as the group label. Defaults to "text". If set to null, the data array index key is used. group.items: The property in each group to use as the array of items in the group. Defaults to "items". If set to null, group.id and group. label are forced to null and the data element is assumed to be a list of selections. id: Value to use as the select element id attribute. Defaults to the same as the name. list.attr: Attributes for the select element. Can be a string or an array of key/value pairs. Defaults to none. list.select: either the value of one selected option or an array of selected options. Default: none. list.translate: Boolean. If set, text and labels are translated via JText::_().

Response

stringHTML for the select list

integerlist

Generates a selection list of integers.

integerlist(integer $start, integer $end, integer $inc, string $name, mixed $attribs = null, mixed $selected = null, string $format = '') : string
static
since

11.1

Arguments

$start

integerThe start integer

$end

integerThe end integer

$inc

integerThe increment

$name

stringThe value of the HTML name attribute

$attribs

mixedAdditional HTML attributes for the tag

$optKey

mixedThe key that is selected

$optText

stringThe name of the object variable for the option value

$selected

stringThe name of the object variable for the option text

$idtag

booleanValue of the field id or null by default

$translate

booleanTrue if options will be translated

Response

stringHTML for the select list

Properties

_optionDefaults

Default values for options. Organized by option group.

static
since

11.1

Type(s)

array