This site contains the document for old version. Please upgrade to the latest version v1.0.0

lessThan validator

Return true if the value is less than or equals to given number

Validators

Options

* — Required option

Option HTML attribute Type Description
inclusive data-fv-lessthan-inclusive Boolean Can be true or false.
If true, the input value must be less than or equal to the comparison one.
If false, the input value must be less than the comparison one
message data-fv-lessthan-message String The error message. The dynamic message is supported
value* data-fv-lessthan-value Float The number to make a comparison to.
It's dynamic option
When setting options via HTML attributes, remember to enable the validator by setting data-fv-lessthan="true".
You don't need to do that when using HTML 5 max="..." attribute.
The message and other options can be updated on the fly via the updateMessage() and updateOption() methods

If you want the value to support custom format, such as a comma for thousand separator, you should use the transformer option. The modifying the value before validating example is good starting point.

Related validators

The following validators might be useful to you: