name
attribute:
<
form
id
=
"
loginForm
"
method
=
"
POST
"
>
<
input
type
=
"
text
"
name
=
"
username
"
/>
...
form
>
<
script
>
document
.
addEventListener
(
'DOMContentLoaded'
,
function
(
e
)
{
FormValidation
.
formValidation
(
document
.
getElementById
(
'loginForm'
)
,
{
fields
:
{
username
:
{
validators
:
{
...
}
}
,
}
}
)
;
}
)
;
script
>
name
attribute for the field.
selector
option to support indicating fields via a CSS selector:
<
form
id
=
"
purchaseForm
"
method
=
"
POST
"
>
<
input
type
=
"
text
"
[data-stripe
=
"
number
"
]
/>
...
form
>
<
script
>
document
.
addEventListener
(
'DOMContentLoaded'
,
function
(
e
)
{
FormValidation
.
formValidation
(
document
.
getElementById
(
'purchaseForm'
)
,
{
fields
:
{
ccNumber
:
{
// The credit card number field can be retrieved
// by [data-stripe="number"] attribute
selector
:
'[data-stripe="number"]'
,
validators
:
{
notEmpty
:
{
...
}
,
creditCard
:
{
...
}
}
}
,
}
,
}
)
;
}
)
;
script
>
name
attribute. Instead, they use the
data-stripe
attribute which are defined by Stripe. The Stripe API then will collects the credit card data from fields using this attribute.