| Name | HTML attribute | Type | Description |
|---|---|---|---|
case
|
data-fv-string-case___case
|
String
|
Can be
lower
(the default value) or
upper
|
message
|
data-fv-string-case___message
|
String
|
The error message |
// You might need to change the importing path
import
stringCase
from
'formvalidation/dist/es6/validators/stringCase'
;
const
result
=
stringCase
(
)
.
validate
(
{
value
:
...
,
options
:
{
'case'
:
...
,
message
:
...
,
}
,
}
)
;
// result is an object of
// {
// valid: true or false,
// message: The error message
// }
// You might need to change the importing path
import
stringCase
from
'formvalidation/dist/es6/validators/stringCase'
;
const
res1
=
stringCase
(
)
.
validate
(
{
value
:
'JOHN SMITH'
,
options
:
{
case
:
'upper'
,
message
:
'The name must be in must be in uppercase'
,
}
,
}
)
;
// res1.valid === true
const
res2
=
stringCase
(
)
.
validate
(
{
value
:
'John Smith'
,
options
:
{
case
:
'lower'
,
message
:
'The name must be in must be in lowercase'
,
}
,
}
)
;
// res2.valid === false