Releases: CharlGottschalk/approvejs
v3.1.2
v3.1.1
Updated documentation links
v3.1.0
Added ignoreNull
property for handling null
values.
Usage:
Test will pass
var rules = {
required: true,
email: true,
ignoreNull: true
};
var result = approve.value(null, rules);
Test will fail
var rules = {
required: true,
email: true
};
var result = approve.value(null, rules);
v3.0.2
v3.0.1
Numeric test now accepts negative values.
v3.0.0
- Added error filtering
- Added test outcome properties
Please read upgrade guide for this release.
v2.1.0
Added test cancellation:
By default, ApproveJS will continue testing every rule and return all tests' error messages. For example:
var rules = {
required: true,
email: true
};
var result = approve.value('', rules);
The above code will check whether the value is present (required = true
) and whether it is a valid email address (email = true
). Should the value fail the required
rule, ApproveJS will continue and also test the email
rule, returning errors for both tests.
It makes sense though, that if the value fails the required
test, that it will automatically fail the email
test, so you might want to stop testing and return only the errors for the failed required
test. For this we use the stop
property which will stop all testing after the first failed rule, i.e.
var rules = {
stop: true,
required: true,
email: true
};
var result = approve.value('', rules);
Now, should the required
rule fail, ApproveJS will stop all testing and return only the error messages for the required
rule.
Note that rules are tested in the order in which they appear in the rule object, i.e.
var rules = {
stop: true,
required: true,
email: true
};
In the code above, required
will be tested first, and email
second whereas in the code below, email
will be tested first, and required
second.
var rules = {
stop: true,
email: true,
required: true
};
v2.0.0
v1.1.2
Converted DOS line endings (\r\n
) to Unix line endings (\n
).
v1.1.1
Added missing ignore case flags