CheckBox

CheckBox

Form component of checkbox element. Feature: if component doesn't checked (checkbox.checked() !== true), then method value() returns always "undefined". To get value regartless checked status it need to use method storedValue()

Constructor

new CheckBox(data)

Parameters:
Name Type Description
data iInputConstructor

(Optional) Object with parameters.

Source:
Example
let checkbox = new CheckBox({
    title: "Are you ready?",
    value: "Yes",
    checked: true
});
console.log(checkbox.value()); // "Yes"
checkbox.checked(false);
console.log(checkbox.value()); // Undefined

Extends

Methods

checked() → {boolean|undefined}

Get/Set checked status of checkbox.

Source:

comment(value) → {string|undefined}

Get/Set comment.

Parameters:
Name Type Description
value string | undefined

String of comment

Overrides:
Source:

default() → {string|undefined}

Get stored value regardless checked status of component.

Source:

disabled(value) → {boolean|undefined}

Value "true" disable the Field.

Parameters:
Name Type Description
value boolean | undefined

Boolean value disable or enable the Field

Overrides:
Source:

error(value) → {string|undefined}

Get/Set value of error message.

Parameters:
Name Type Description
value string | undefined

String of placeholder

Overrides:
Source:
Example
let input = new Input();
input.status("error");
input.error("Invalid value");

name(value) → {string|undefined}

Get/Set name of Field-element. Methods Box#data and Box#form looking for Fields with defined this property only.

Parameters:
Name Type Description
value string | undefined

String of placeholder

Overrides:
Source:

placeholder(value) → {string|undefined}

Get/Set placeholder of element.

Parameters:
Name Type Description
value string | undefined

String of placeholder

Overrides:
Source:

status(value) → {string|undefined}

Get/Set particular style of element.

Parameters:
Name Type Description
value string | undefined

Available statuses: 'ok', 'error', 'accent', 'warn'

Overrides:
Source:

storedValue() → {string|undefined}

Get stored value regardless checked status of component.

Source:

title(value) → {string|undefined}

Get/Set title of element.

Parameters:
Name Type Description
value string | undefined

String of title

Overrides:
Source:

valid() → {boolean}

Value "true" if value of field valid.

Overrides:
Source:

validator() → {iValidatorClass}

method .valid() use validator if he is defined. The logic of validation inside iValidation class.

Overrides:
Source:

value(value) → {string|undefined}

Get/Set value of Field-element.

Parameters:
Name Type Description
value string | undefined

String of placeholder

Overrides:
Source: