New features:
Form attributes:
<form
data-bv-message="This value is not valid"
data-bv-feedbackicons-valid="glyphicon glyphicon-ok"
data-bv-feedbackicons-invalid="glyphicon glyphicon-remove"
data-bv-feedbackicons-validating="glyphicon glyphicon-refresh"
>
Field attributes:
<input type="text" class="form-control" name="username"
data-bv-message="The username is not valid"
data-bv-notempty data-bv-notempty-message="The username is required and cannot be empty"
data-bv-stringlength="true" data-bv-stringlength-min="6" data-bv-stringlength-max="30" data-bv-stringlength-message="The username must be more than 6 and less than 30 characters long"
data-bv-different="true" data-bv-different-field="password" data-bv-different-message="The username and password cannot be the same as each other"
data-bv-remote="true" data-bv-remote-url="remote.php" data-bv-remote-message="The username is not available"
/>
| HTML 5 attribute | Validator |
|---|---|
min="..." |
greaterThan validator |
max="..." |
lessThan validator |
maxlength="..." |
stringLength validator |
pattern="..." |
regexp validator |
required |
notEmpty validator |
type="color" |
hexColor validator |
type="email" |
emailAddress validator |
type="range" |
between validator |
type="url" |
uri validator |
It's possible to use data-bv-trigger attribute:
<form data-bv-trigger="keyup">
<input type="text" class="form-control" name="firstName" placeholder="First name"
data-bv-trigger="keyup" />
...
<input type="text" class="form-control" name="lastName" placeholder="First name"
data-bv-trigger="blur" />
</form>
or trigger option:
$(form).bootstrapValidator({
trigger: 'blur', // Set for all fields
fields: {
firstName: {
trigger: 'keyup', // Custom for each field. Can be 'event1 event2 event3'
validators: {
...
}
},
lastName: {
trigger: 'blur',
validators: {
...
}
}
}
});
<div class="form-group">
<input class="form-control" type="text" name="surveyAnswer[]" />
</div>
<div class="form-group">
<input class="form-control" type="text" name="surveyAnswer[]" />
</div>
<div class="form-group">
<input class="form-control" type="text" name="surveyAnswer[]" />
</div>
setLiveMode() method to turn on/off the live validating modeiban validator for validating IBAN (International Bank Account Number)uuid validator, support UUID v3, v4, v5numeric validatorinteger validatorhex validatorstringCase validator to check a string is lower or upper caseImprovements:
regexp validator allows to pass a stringtype="hidden") and invisible element, thanks to @easonhan007Changes:
disableSubmitButtons() is now marked as a public APIupdateStatus() method now accepts the field name onlyFixes:
submitHandler and the form is validfields.[fieldName].message option is not used when showing the error messageFixes:
form.submit() inside submitHandlernotEmpty validator doesn't work on file inputNew features:
selector option for each field. The field can be defined by CSS validator instead of the name attributecontainer option for each field to indicate where the error messages are shownip validator. Support both IPv4 and IPv6isbn validator, support both ISBN 10 and ISBN 13step validatormac validatorbase64 validatorcvv validatorphone validator. Support US phone number only, thanks to @gercheqImprovements:
creditCard validator now validates both IIN ranges and lengthNew features:
date validatorupdateStatus() method to make the plugin play well with anotherenabled option and enableFieldValidators() method to enable/disable all validators to given fieldbower.json file, thanks to @ikanedoChanges:
columns option. Now the plugin works normally no matter how many columns the form usesresetForm method now only resets fields with validator rulesFixes:
submitHandler or default submission isn't called after remote validation completesNew features:
choice validator, thanks to @emilchristensenremote validator supports dynamic datasubmitHandler() parameterresetForm() methodFixes:
notEmpty validator for radios and checkboxes, thanks to @kristian-puccioremote validator returns truecallback validator passes wrong parameter, thanks to @iplusDocument:
Improvements:
remote validator: Allow to set additional data to remote URLFixes:
Improvements:
New features:
live optionsubmitHandler optioncreditCard validatordifferent validatorcallback validatorImprovements:
col-xs-), small (col-sm-), medium (col-md-) elementsFixes:
regexp validator does not workNews features:
Improvements: