Expand all

abstract OO.ui.mixin.RequiredElement

Constructor

new OO.ui.mixin.RequiredElement([config])abstract #

RequiredElement is mixed into other classes to provide a required attribute.

Parameters:

Name Type Attributes Description
config Object optional

Configuration options

Properties:
Name Type Attributes Default Description
$required jQuery optional

The element to which the required attribute is applied. If this config is omitted, the required functionality is applied to $input if it exists, or $element if it doesn't.

required boolean optional
false

Mark the field as required with true.

indicatorElement OO.ui.Element optional
this

Element which mixes in OO.ui.mixin.IndicatorElement Will set the indicator on that element to 'required' when the element is required. Note that false & setting indicator: 'required' will result in no indicator shown.

Source:
RequiredElement is mixed into other classes to provide a required attribute.

Methods

isRequired() → {boolean} #

Check if the input is required.

Source:

Returns:

Type
boolean
Check if the input is required.

setRequired(state) → {OO.ui.Widget}chainable #

Set the required state of the input.

Parameters:

Name Type Description
state boolean

Make input required

Source:

Returns:

The widget, for chaining

Type
OO.ui.Widget
Set the required state of the input.

setRequiredElement($required) #

Set the element which can take the required attribute.

This method is used to retarget a RequiredElement mixin so that its functionality applies to the specified element. If an element is already set, the mixin’s effect on that element is removed before the new element is set up.

Parameters:

Name Type Description
$required jQuery

Element that should use the 'required' functionality

Source:
Set the element which can take the required attribute.