state

function in module validity

state(form);

Returns the validation state of a form

🚧

Caution

This function loops through all the validity inputs on the form, checking the validation state of each one. The inputs are cached, but If there are a lot of inputs on the form, this can get expensive

Parameters

ParamTypeDetails
formobjectThe form to query

Returns

string - the validation state of the form. See Validation States for a list of possible states

Validation States

StateDescription
unvalidatedNone of the controls on the form have been validated
partialSome of the controls on the form have been validated
invalidAll of the controls on the form have been validated, and at least one control is invalid
validAll of the controls on the form have been validated, and all of the controls are valid

Usage

Call from within a controller:

controller("ExampleCtrl", ["validity", function (validity) {
    var state = validity.state(/* form */);
}]);