state
function in module validity
state(form);
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
Param | Type | Details |
---|---|---|
form | object | The form to query |
Returns
string
- the validation state of the form. See Validation States for a list of possible states
Validation States
State | Description |
---|---|
unvalidated | None of the controls on the form have been validated |
partial | Some of the controls on the form have been validated |
invalid | All of the controls on the form have been validated, and at least one control is invalid |
valid | All 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 */);
}]);
Updated less than a minute ago