| Name | HTML attribute | Type | Description |
|---|---|---|---|
message
|
data-fv-email-address___message
|
String
|
The error message |
multiple
|
data-fv-email-address___multiple
|
String
|
Allow multiple email addresses, separated by a comma or semicolon. The default value is
false
|
separator
|
data-fv-email-address___separator
|
String
|
Regex for character or characters expected as separator between addresses. By default, it is /[,;]/, i.e. comma or semicolon |
// You might need to change the importing path
import
emailAddress
from
'formvalidation/dist/es6/validators/emailAddress'
;
const
result
=
emailAddress
(
)
.
validate
(
{
value
:
...
,
options
:
{
message
:
...
,
multiple
:
...
,
separator
:
...
,
}
,
}
)
;
/*
result is an object of
{
valid: true or false,
message: The error message
}
*/
type="email"
attribute.
// You might need to change the importing path
import
emailAddress
from
'formvalidation/dist/es6/validators/emailAddress'
;
const
res1
=
emailAddress
(
)
.
validate
(
{
value
:
''
,
options
:
{
message
:
'The value is not a valid email address'
,
}
,
}
)
;
// res1.valid === true
const
res2
=
emailAddress
(
)
.
validate
(
{
value
:
'just"not"'
,
options
:
{
message
:
'The value is not a valid email address'
,
}
,
}
)
;
// res2.valid === false