Validation().bind()
Binds the Validation
to a validatable object.
Syntax
Parameters
-
validatableObject
optional
An object with an accessible by theoptions.path
value to be validated.
Default: Empty object{}
. -
options
optional
An object that specifies validation options. The available options are:-
path
optional
A string path to the validatable value with dots.
as separators.
Default:undefined
. -
initValue
optional
The initial value is used while validating against constraints added with the parameterkeepValid=true
or if theValidation
was created with the parameteroptional=true
.
Default:undefined
.
-
Return value
The Validation
object.
Exceptions
- If the
validatableObject
is the same as that which theValidation
is already bound to, throws the corresponding error. - If invoked on a grouping
Validation
, throws the corresponding error.
Description
Binds the Validation
object to the validatableObject
. This method is used on a single Validation
when a validatable object is not accessible at creation time. If options.path
and options.initValue
are not set, uses the values that were set at creation time.
This method is used under the hood in the Validation.profile()
method.