<
html
>
<
head
>
<
link
rel
=
"
stylesheet
"
href
=
"
/vendors/formvalidation/dist/css/formValidation.min.css
"
/>
head
>
<
body
>
<
form
id
=
"
demoForm
"
method
=
"
POST
"
>
...
<
button
type
=
"
submit
"
>
Submit
button
>
form
>
<
script
src
=
"
https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.35.3/es6-shim.min.js
"
>
script
>
<
script
src
=
"
/vendors/formvalidation/dist/js/FormValidation.min.js
"
>
script
>
<
script
>
document
.
addEventListener
(
'DOMContentLoaded'
,
function
(
e
)
{
FormValidation
.
formValidation
(
document
.
getElementById
(
'demoForm'
)
,
{
fields
:
{
...
}
,
plugins
:
{
submitButton
:
new
FormValidation
.
plugins
.
SubmitButton
(
{
// Optional setting:
// Set it to true if you are using a traditional ASP.Net form
// and there is a custom handler for the submit button
// aspNetButton: false,
}
)
,
...
}
,
}
)
;
}
)
;
script
>
body
>
html
>
vendors
directory. You might need to change the path depending on where you place them on the server.
| Option | Type | Description |
|---|---|---|
aspNetButton
|
Boolean
|
Set it to
true
to support classical ASP.Net form. It is
false
by default
|
buttons
|
Function
|
It is a function that accepts the current form element and returns the list of submit buttons. By default, the plugin ignores all the submit button/input which have the
formnovalidate
attribute
|
buttons
option is useful in case we have an external button which is outside of the form:
<
form
id
=
"
demoForm
"
>
...
form
>
<
button
type
=
"
button
"
id
=
"
externalButton
"
/>
buttons
option should look like as following:
FormValidation
.
formValidation
(
document
.
getElementById
(
'demoForm'
)
,
{
fields
:
...
,
plugins
:
new
FormValidation
.
plugins
.
SubmitButton
(
{
buttons
:
function
(
form
)
{
return
[
]
.
slice
.
call
(
document
.
getElementById
(
'externalButton'
)
)
;
}
,
}
)
,
}
)
;
buttons
option
selector
option is removed
aspNetButton
option to
true