.has-success
or
.has-danger
class to the container element. It also adds
.is-valid
or
.is-invalid
class to the field element. If you think that it's better to indicate error status only due to the similarity of these status colors, you can remove
.has-success
class from the container.
FormValidation
.
formValidation
(
form
,
{
fields
:
{
...
}
,
plugins
:
{
...
}
,
}
)
.
on
(
'core.element.validated'
,
function
(
e
)
{
// e.element presents the field element
// e.valid indicates the field is valid or not
if
(
e
.
valid
)
{
// Remove has-success from the container
const
groupEle
=
FormValidation
.
utils
.
closest
(
e
.
element
,
'.form-group'
)
;
if
(
groupEle
)
{
FormValidation
.
utils
.
classSet
(
groupEle
,
{
'has-success'
:
false
,
}
)
;
}
// Remove is-valid from the element
FormValidation
.
utils
.
classSet
(
e
.
element
,
{
'is-valid'
:
false
,
}
)
;
}
}
)
;