Namespace: fieldSettings

fieldSettings

The default properties and methods for a field.

This is configured in settings.fields array property.

Each field settings can be affected by the main settings and by the fieldsetSettings.

Members


<static> autostart :Boolean

Only client-side.

Validate field elements on instance time.

Type:
  • Boolean
Default Value:
  • false

<static> disabled :Boolean

Field will be ignored in validation if true.

Type:
  • Boolean
Default Value:
  • false

<static> display :external:jQuery

Only client-side.

The element where to set the current field message error. If not specified, the messages won't be shown on UI.

When configured by HTML attribute data-vv-display, the value expected should be a jQuery selector. Otherwise this can be anything to select with the jQuery selector method.

Type:

<static> firstValidationEvent :String

Only client-side.

What event to listen to trigger the first validation on field.

Type:
  • String
Default Value:

<static> intern :Boolean

Only client-side.

When a field is validated, don't show changes visually nor show messages. This is used to know whether they are valid or not, update the fields elements states and trigger events.

Type:
  • Boolean
Default Value:
  • false

<static> listenTo :String|Array

The name of the field or the array of the fields this one is listening to. When the provided fields are validated, this one is also validated. Currently it is only used for the validation methods, not client-side.

Type:
  • String | Array
Default Value:

<static> name :String

The field name. This property is required.

Type:
  • String

<static> onlyUI :Boolean

Only client-side.

Ignore field in validation in server side.

Type:
  • Boolean
Default Value:
  • false

<static> required :Boolean

Field is required and cannot be undefined nor empty string. If the field is not required but it does NOT have a truthy value, then this will pass over all validators.

Type:
  • Boolean
Default Value:
  • false

<static> to :String|Array

A function to convert the field value. Currently it is only used for the validation methods, not client-side.

Type:
  • String | Array
Default Value:

<static> validationEvents :String

Only client-side.

After first validation, what events to listen to re-validate field.

Type:
  • String
Default Value:

<static> validators :Object

The validators list. This is an object with keys as the validators names and values as their configuration. If the value is simply a boolean true, the validator will be invoked without options. It it is string, number or object it will be send as validator options. If value is false, the validator will not be used.

These won't be used if the field value is boolean.

You can use all validators from the validator package.

This object will be merged with the fieldsets validators this field is in.

Type:
  • Object

Methods


<static> onlyIf()

A condition gate to verify if the field will be validated. Receives the field value as first parameter and has to return a boolean, if true the validation will procced as normal, otherwise the validation will halt.

This is a function with the utility context as function context so don't use arrow functions.

Returns:
Type
Boolean

<static> value($field)

Only client-side.

Method to get the value of the field. This will have the utilty context so don't use arrow functions.

By default this can retrieve the value of <input>s of any kind except image, submit, reset, file and button, <textarea>s and <select>s.

You can overwrite this to create your own custom field value getter. Otherwise leave this property as default.

The first paramter $field will be binded to the function and it is the jQuery element the fields belongs to.

Parameters:
Name Type Description
$field external:jQuery

The field element.

Returns:

The value returned will depend on the type of element or what you configure if you overwrite this method.

Type
*