| Name | HTML attribute | Type | Description |
|---|---|---|---|
inclusive
|
data-fv-less-than___inclusive
|
Boolean
|
Can be
true
(default) 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.
|
|||
max
*
|
data-fv-less-than___max
|
Float
|
The number to make a comparison to |
message
|
data-fv-less-than___message
|
String
|
The error message |
// You might need to change the importing path
import
lessThan
from
'formvalidation/dist/es6/validators/lessThan'
;
const
result
=
lessThan
(
)
.
validate
(
{
value
:
...
,
options
:
{
inclusive
:
...
,
max
:
...
,
message
:
...
,
}
,
}
)
;
/*
result is an object of
{
valid: true or false,
message: The error message
}
*/
// You might need to change the importing path
import
lessThan
from
'formvalidation/dist/es6/validators/lessThan'
;
const
res1
=
lessThan
(
)
.
validate
(
{
value
:
20
,
options
:
{
max
:
30
,
message
:
'The value has to be less than 30'
,
}
,
}
)
;
// res1.valid === true
const
res2
=
lessThan
(
)
.
validate
(
{
value
:
30
,
options
:
{
inclusive
:
false
,
max
:
30
,
message
:
'The value has to be less than 30'
,
}
,
}
)
;
// res2.valid === false
max
option isn't passed to the placeholder message