Documentation

SelectField extends BaseField
in package

SelectField class represents a select input field in a form.

It extends the BaseField class and provides functionality for creating dropdown selection fields with various options.

Table of Contents

Constants

TYPE_SELECT  : mixed = 'select'

Properties

$attribute  : string
$model  : Model
$type  : string

Methods

__construct()  : mixed
Field constructor.
__toString()  : string
Returns the HTML representation of the field including label, input and error message.
options()  : string
Generates HTML option elements for a select field.
renderInput()  : string
Render a select input field with options

Constants

Properties

Methods

__construct()

Field constructor.

public __construct(Model $model, string $attribute) : mixed
Parameters
$model : Model
$attribute : string

__toString()

Returns the HTML representation of the field including label, input and error message.

public __toString() : string
Return values
string

options()

Generates HTML option elements for a select field.

public options(array<string|int, mixed> $options) : string
Parameters
$options : array<string|int, mixed>

An associative array of options where keys are values and values are labels.

Return values
string

The concatenated HTML option tags.

renderInput()

Render a select input field with options

public renderInput() : string

This method generates the HTML for a