| Name | HTML attribute | Type | Description |
|---|---|---|---|
inclusive
|
data-fv-between___inclusive
|
Boolean
|
Can be
true
or
false
. If
true
, the input value must be in the range strictly
|
max
*
|
data-fv-between___max
or
max
|
Float
|
The upper value in the range |
message
|
data-fv-between___message
|
String
|
The error message |
min
*
|
data-fv-between___min
or
min
|
Float
|
The lower value in the range |
min
and
max
attributes, please set
type="range"
.
// You might need to change the importing path
import
between
from
'formvalidation/dist/es6/validators/between'
;
const
result
=
between
(
)
.
validate
(
{
value
:
...
,
options
:
{
inclusive
:
...
,
min
:
...
,
max
:
...
,
message
:
...
,
}
,
}
)
;
/*
result is an object of
{
valid: true or false,
message: The error message
}
*/
// You might need to change the importing path
import
between
from
'formvalidation/dist/es6/validators/between'
;
const
checkLatitude
=
between
(
)
.
validate
(
{
value
:
45
,
options
:
{
inclusive
:
true
,
min
:
-
90
,
max
:
90
,
message
:
'The latitude must be between -90.0 and 90.0'
,
}
,
}
)
;
// checkLatitude.valid === true
const
checkLongitude
=
between
(
)
.
validate
(
{
value
:
200
,
options
:
{
inclusive
:
true
,
min
:
-
180
,
max
:
180
,
message
:
'The latitude must be between -180.0 and 180.0'
,
}
,
}
)
;
// checkLongitude.valid === false
max
and
min
options aren't passed to the placeholder message