htmlResponsiveInputField
extends htmlInputField
in package
A responsive input field that combines label, input field and help.
Table of Contents
- ALIGN_BOTTOM = 3
- align to bottom
- ALIGN_CENTER = 4
- align to center
- ALIGN_LEFT = 1
- align to left
- ALIGN_RIGHT = 2
- align to right
- ALIGN_TOP = 0
- align to top
- $alignment : int|null
- alignment when inside a table
- $colspan : int|null
- colspan if inside a table
- $rowspan : int|null
- rowspan if inside a table
- $autocomplete : bool
- enable autocomplete
- $autocompleteValues : array<string|int, mixed>
- $autoTrim : bool
- marks the input field as auto trimmed (remove spaces at start/end)
- $calendarFormat : string
- calendar format
- $calendarFormatWithSeconds : bool
- calendar with seconds
- $calendarFormatWithTime : bool
- calendar with time
- $checkPasswordStrength : bool
- check password strength
- $cssClasses : array<string|int, mixed>|null
- $disableAutoFill : bool
- disables browser autofilling of password fields
- $fieldMaxLength : int|null
- field max length (default 1000)
- $fieldName : string
- unique field name
- $fieldSize : int|null
- field size (default 30)
- $fieldValue : string|null
- field value
- $id : string|null
- id
- $isEnabled : bool
- enabled or disabled
- $isPassword : bool
- password field
- $maxValue : int|null
- maximum value
- $minValue : int|null
- minimum value
- $obfuscate : bool
- indicates that the value should be saved in obfuscated form
- $onInput : string|null
- oninput event
- $onKeyPress : string|null
- on keypress event
- $onKeyUp : string|null
- on keyupp event
- $required : bool
- required field
- $sameValueFieldID : string|null
- field ID that needs to have same value (e.g. password field)
- $showCalendar : bool
- show calendar
- $showDnSelection : bool
- show DN selection
- $stepValue : int|null
- step for numeric values
- $tableCellCssClasses : array<string|int, mixed>|null
- $title : string|null
- title attribute
- $transient : bool
- indicates that this field should not automatically be saved in the self-service or server profile
- $type : string
- input type
- $validationPattern : string|null
- validation pattern
- $accessibilityLabel : string|null
- accessibility label
- $dataAttributes : array<string|int, mixed>
- $helpID : string|null
- help ID
- $helpModule : string|null
- help module name
- $label : string
- Descriptive label
- $renderParentHtml : bool
- render HTML of parent class
- $shortLabel : bool
- short label
- __construct() : mixed
- Constructor
- addDataAttribute() : void
- Adds a data attribute.
- disableAutoTrim() : void
- enableAutocompletion() : void
- Enables autocompletion for this input field.
- filterSelectBox() : void
- Turns this field into a live filter for a select box.
- generateHTML() : array<string, string>
- Prints the HTML code for this element.
- getAccessibilityMarkup() : string
- Returns the markup for the accessibility data.
- getAlignmentString() : string
- Returns the HTML attributes for the alignment.
- getColspanString() : string
- Returns the HTML attribute for the colspan.
- getCSSClasses() : array<string|int, string>|null
- Returns the CSS classes of this element.
- getRowspanString() : string
- Returns the HTML attribute for the rowspan.
- getTableCellCSSClasses() : array<string|int, string>|null
- Returns the CSS classes of the surrounding table cell for this element.
- setAccessibilityLabel() : void
- Sets the accessibility label.
- setCSSClasses() : void
- Adds CSS classes to this element.
- setFieldMaxLength() : void
- Sets the maximum field length.
- setFieldSize() : void
- Sets the field size (default is 30).
- setHelpId() : void
- Sets the help ID.
- setHelpModule() : void
- Sets the help module.
- setId() : void
- Sets the element ID.
- setIsEnabled() : void
- Specifies if this component is enabled and accepts user modification.
- setIsPassword() : void
- Specifies if this is a password field.
- setMinimumAndMaximumNumber() : void
- Sets the field as number field with minimum and maximum values.
- setObfuscate() : void
- Specifies if the value should be saved in obfuscated form (e.g. self-service profile).
- setOnInput() : void
- Sets the JavaScript for the onInput event.
- setOnKeyPress() : void
- Sets the JavaScript for the onKeyPress event.
- setOnKeyUp() : void
- Sets the JavaScript for the onKeyUp event.
- setRequired() : void
- Specifies if the input field is required.
- setSameValueFieldID() : void
- Specifies the ID of a second field that must have the same value as this field.
- setShortLabel() : void
- Use a short label (4 columns instead of 6) for tablet/desktop.
- setStepValue() : void
- Sets the step value for number fields.
- setTableCellCSSClasses() : void
- Adds CSS classes to the surrounding table cell for this element.
- setTitle() : void
- Sets the title for the input field.
- setTransient() : void
- Specifies that the value should not be automatically saved when used in self-service or server profile (default: false).
- setType() : void
- Sets the input type.
- setValidationPattern() : void
- Sets the validation pattern.
- showCalendar() : void
- Shows a calendar when the field is selected.
- showDnSelection() : void
- Shows a DN selection next to input field.
- getDataAttributesAsString() : string
- Returns the data attributes as rendered string.
- isAutoTrim() : bool
- Returns if the field content should be auto-trimmed (remove spaces at start/end).
Constants
ALIGN_BOTTOM
align to bottom
public
mixed
ALIGN_BOTTOM
= 3
ALIGN_CENTER
align to center
public
mixed
ALIGN_CENTER
= 4
ALIGN_LEFT
align to left
public
mixed
ALIGN_LEFT
= 1
ALIGN_RIGHT
align to right
public
mixed
ALIGN_RIGHT
= 2
ALIGN_TOP
align to top
public
mixed
ALIGN_TOP
= 0
Properties
$alignment
alignment when inside a table
public
int|null
$alignment
= \null
$colspan
colspan if inside a table
public
int|null
$colspan
= \null
$rowspan
rowspan if inside a table
public
int|null
$rowspan
= \null
$autocomplete
enable autocomplete
protected
bool
$autocomplete
= \false
$autocompleteValues
protected
array<string|int, mixed>
$autocompleteValues
= []
autocompletion suggestions
$autoTrim
marks the input field as auto trimmed (remove spaces at start/end)
protected
bool
$autoTrim
= \true
$calendarFormat
calendar format
protected
string
$calendarFormat
= ''
$calendarFormatWithSeconds
calendar with seconds
protected
bool
$calendarFormatWithSeconds
= \false
$calendarFormatWithTime
calendar with time
protected
bool
$calendarFormatWithTime
= \false
$checkPasswordStrength
check password strength
protected
bool
$checkPasswordStrength
= \false
$cssClasses
protected
array<string|int, mixed>|null
$cssClasses
= []
CSS classes
$disableAutoFill
disables browser autofilling of password fields
protected
bool
$disableAutoFill
= \false
$fieldMaxLength
field max length (default 1000)
protected
int|null
$fieldMaxLength
= 1000
$fieldName
unique field name
protected
string
$fieldName
$fieldSize
field size (default 30)
protected
int|null
$fieldSize
= 30
$fieldValue
field value
protected
string|null
$fieldValue
= ''
$id
id
protected
string|null
$id
= \null
$isEnabled
enabled or disabled
protected
bool
$isEnabled
= \true
$isPassword
password field
protected
bool
$isPassword
= \false
$maxValue
maximum value
protected
int|null
$maxValue
= \null
$minValue
minimum value
protected
int|null
$minValue
= \null
$obfuscate
indicates that the value should be saved in obfuscated form
protected
bool
$obfuscate
= \false
$onInput
oninput event
protected
string|null
$onInput
= \null
$onKeyPress
on keypress event
protected
string|null
$onKeyPress
= \null
$onKeyUp
on keyupp event
protected
string|null
$onKeyUp
= \null
$required
required field
protected
bool
$required
= \false
$sameValueFieldID
field ID that needs to have same value (e.g. password field)
protected
string|null
$sameValueFieldID
= \null
$showCalendar
show calendar
protected
bool
$showCalendar
= \false
$showDnSelection
show DN selection
protected
bool
$showDnSelection
= \false
$stepValue
step for numeric values
protected
int|null
$stepValue
= \null
$tableCellCssClasses
protected
array<string|int, mixed>|null
$tableCellCssClasses
= []
table cell CSS classes
$title
title attribute
protected
string|null
$title
= \null
$transient
indicates that this field should not automatically be saved in the self-service or server profile
protected
bool
$transient
= \false
$type
input type
protected
string
$type
= 'text'
$validationPattern
validation pattern
protected
string|null
$validationPattern
= \null
$accessibilityLabel
accessibility label
private
string|null
$accessibilityLabel
= \null
$dataAttributes
private
array<string|int, mixed>
$dataAttributes
= []
data attributes
$helpID
help ID
private
string|null
$helpID
= \null
$helpModule
help module name
private
string|null
$helpModule
= \null
$label
Descriptive label
private
string
$label
$renderParentHtml
render HTML of parent class
private
bool
$renderParentHtml
= \false
$shortLabel
short label
private
bool
$shortLabel
= \false
Methods
__construct()
Constructor
public
__construct(string $label, string $fieldName[, string $fieldValue = null ][, string|array<string|int, string>|null $helpID = null ][, bool $required = false ]) : mixed
Parameters
- $label : string
-
descriptive label
- $fieldName : string
-
unique field name
- $fieldValue : string = null
-
value of input field (optional)
- $helpID : string|array<string|int, string>|null = null
-
help ID or array of help ID + module name (optional)
- $required : bool = false
-
field is required
Return values
mixed —addDataAttribute()
Adds a data attribute.
public
addDataAttribute(string $key, string $value) : void
Parameters
- $key : string
-
attribute name (without "data-")
- $value : string
-
attribute value
Return values
void —disableAutoTrim()
public
disableAutoTrim() : void
Return values
void —enableAutocompletion()
Enables autocompletion for this input field.
public
enableAutocompletion(array<string|int, string> $values) : void
Parameters
- $values : array<string|int, string>
-
list of values to suggest
Return values
void —filterSelectBox()
Turns this field into a live filter for a select box.
public
filterSelectBox(string $name) : void
Cannot be used together with setOnKeyUp().
Parameters
- $name : string
-
select box name
Return values
void —generateHTML()
Prints the HTML code for this element.
public
generateHTML(mixed $module, mixed $input, mixed $values, mixed $restricted) : array<string, string>
Parameters
- $module : mixed
-
Name of account module
- $input : mixed
-
List of meta-HTML elements
- $values : mixed
-
List of values which override the defaults in $input (name => value)
- $restricted : mixed
-
If true then no buttons will be displayed
Return values
array<string, string> —List of input field names and their type (name => type)
getAccessibilityMarkup()
Returns the markup for the accessibility data.
public
getAccessibilityMarkup() : string
Return values
string —markup to be included in HTML tag (starting with space)
getAlignmentString()
Returns the HTML attributes for the alignment.
public
getAlignmentString() : string
Return values
string —alignment HTML attributes (e.g. align="right" valign="top")
getColspanString()
Returns the HTML attribute for the colspan.
public
getColspanString() : string
Return values
string —colspan HTML attribute (e.g. colspan=3)
getCSSClasses()
Returns the CSS classes of this element.
public
getCSSClasses() : array<string|int, string>|null
Return values
array<string|int, string>|null —$classes CSS class names
getRowspanString()
Returns the HTML attribute for the rowspan.
public
getRowspanString() : string
Return values
string —rowspan HTML attribute (e.g. rowspan=3)
getTableCellCSSClasses()
Returns the CSS classes of the surrounding table cell for this element.
public
getTableCellCSSClasses() : array<string|int, string>|null
Return values
array<string|int, string>|null —CSS classes
setAccessibilityLabel()
Sets the accessibility label.
public
setAccessibilityLabel(string|null $accessibilityLabel) : void
Parameters
- $accessibilityLabel : string|null
-
label
Return values
void —setCSSClasses()
Adds CSS classes to this element.
public
setCSSClasses(array<string|int, string>|null $classes) : void
Parameters
- $classes : array<string|int, string>|null
-
CSS class names
Return values
void —setFieldMaxLength()
Sets the maximum field length.
public
setFieldMaxLength(int|null $fieldMaxLength) : void
Parameters
- $fieldMaxLength : int|null
-
length
Return values
void —setFieldSize()
Sets the field size (default is 30).
public
setFieldSize(int|null $fieldSize) : void
Parameters
- $fieldSize : int|null
-
size
Return values
void —setHelpId()
Sets the help ID.
public
setHelpId(string|null $helpID) : void
Parameters
- $helpID : string|null
-
help ID
Return values
void —setHelpModule()
Sets the help module.
public
setHelpModule(string|null $helpModule) : void
Parameters
- $helpModule : string|null
-
help module name
Return values
void —setId()
Sets the element ID.
public
setId(string $id) : void
Parameters
- $id : string
-
id
Return values
void —setIsEnabled()
Specifies if this component is enabled and accepts user modification.
public
setIsEnabled(bool $isEnabled) : void
Parameters
- $isEnabled : bool
-
enabled if true
Return values
void —setIsPassword()
Specifies if this is a password field.
public
setIsPassword(bool $isPassword[, bool $checkStrength = false ][, bool $disableAutoFill = false ]) : void
Parameters
- $isPassword : bool
-
password field
- $checkStrength : bool = false
-
check if matches password policy (default: false)
- $disableAutoFill : bool = false
-
prevent autofilling by browser
Return values
void —setMinimumAndMaximumNumber()
Sets the field as number field with minimum and maximum values.
public
setMinimumAndMaximumNumber(int $minimum[, int|null $maximum = null ][, int $step = 1 ]) : void
Parameters
- $minimum : int
-
minimum
- $maximum : int|null = null
-
maximum
- $step : int = 1
-
step value
Return values
void —setObfuscate()
Specifies if the value should be saved in obfuscated form (e.g. self-service profile).
public
setObfuscate(bool $obfuscate) : void
Parameters
- $obfuscate : bool
-
obfuscate value
Return values
void —setOnInput()
Sets the JavaScript for the onInput event.
public
setOnInput(string $onInput) : void
Parameters
- $onInput : string
-
JavaScript code
Return values
void —setOnKeyPress()
Sets the JavaScript for the onKeyPress event.
public
setOnKeyPress(string $onKeyPress) : void
Parameters
- $onKeyPress : string
-
JavaScript code
Return values
void —setOnKeyUp()
Sets the JavaScript for the onKeyUp event.
public
setOnKeyUp(string $onKeyUp) : void
Parameters
- $onKeyUp : string
-
JavaScript code
Return values
void —setRequired()
Specifies if the input field is required.
public
setRequired(bool $required) : void
Parameters
- $required : bool
-
required
Return values
void —setSameValueFieldID()
Specifies the ID of a second field that must have the same value as this field.
public
setSameValueFieldID(string $sameValueFieldID) : void
This field is marked red if different or green if equal.
Parameters
- $sameValueFieldID : string
-
ID of reference field
Return values
void —setShortLabel()
Use a short label (4 columns instead of 6) for tablet/desktop.
public
setShortLabel() : void
Return values
void —setStepValue()
Sets the step value for number fields.
public
setStepValue(int $step) : void
Parameters
- $step : int
-
step value (e.g. 1)
Return values
void —setTableCellCSSClasses()
Adds CSS classes to the surrounding table cell for this element.
public
setTableCellCSSClasses(array<string|int, string>|null $classes) : void
Parameters
- $classes : array<string|int, string>|null
-
CSS class names
Return values
void —setTitle()
Sets the title for the input field.
public
setTitle(string $title) : void
Parameters
- $title : string
-
title value
Return values
void —setTransient()
Specifies that the value should not be automatically saved when used in self-service or server profile (default: false).
public
setTransient(bool $transient) : void
Parameters
- $transient : bool
-
transient field
Return values
void —setType()
Sets the input type.
public
setType(string $type) : void
Parameters
- $type : string
-
type (e.g. number)
Return values
void —setValidationPattern()
Sets the validation pattern.
public
setValidationPattern(string $pattern) : void
Parameters
- $pattern : string
-
pattern (e.g. "[0-9]{3}")
Return values
void —showCalendar()
Shows a calendar when the field is selected.
public
showCalendar(string $format[, bool $withTime = false ][, bool $withSeconds = false ]) : void
Parameters
- $format : string
-
calendar format (e.g. "Y-m-d" or "Y-m-d H:i:S")
- $withTime : bool = false
-
activate time selection (default: false)
- $withSeconds : bool = false
-
show seconds (default: false)
Return values
void —showDnSelection()
Shows a DN selection next to input field.
public
showDnSelection() : void
Return values
void —getDataAttributesAsString()
Returns the data attributes as rendered string.
protected
getDataAttributesAsString() : string
Return values
string —data attributes
isAutoTrim()
Returns if the field content should be auto-trimmed (remove spaces at start/end).
protected
isAutoTrim() : bool
Return values
bool —auto-trim input