- Overview
- Documents
jqBootstrapValidation is a JQuery validation plugin for bootstrap forms.
-
sex shop
sex shop
sex shop
sex shop
sex shop
seks shop
spanish fly
psikolog
sohbet numara
sohbet hatti
Source: reactiveraven.github.io
1. INCLUDE JS FILES
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> <!-- or use local jquery --> <script src="/js/jqBootstrapValidation.js"></script>
2. HTML
<input type="email" id="email" required> <input name="emailAgain" data-validation-matches-match="email" data-validation-matches-message= "Must match email address entered above" > <input type="checkbox" name="terms-and-conditions" required data-validation-required-message= "You must agree to the terms and conditions" > <input type="checkbox" name="qualityControl[]" value="fast" minchecked="2" data-validation-minchecked-message="Choose two" maxchecked="2" data-validation-maxchecked-message= "You can't have it all ways" >
3. JAVASCRIPT
$(function () { $("input,select,textarea").not("[type=submit]").jqBootstrapValidation(); } );
4. VALIDATORS
-
HTML5 BASED
- Number
- Required
- Max
- Min
- Max length
- Min length
- Pattern
-
EXTRAS
- Match
- Max checked
- Min checked
- Regex
-
Callback
- AJAX
5. OPTIONS
sniffHtml
Internally, jqBootstrapValidation only uses data attributes. By default, it will also sniff for native HTML5 form validation attributes, as detailed above.
If you decide this isn't what you want, you can restrict jqBootstrapValidation to only data attributes by setting sniffHtml to false when calling it on your form elements.$(...).jqBootstrapValidation({sniffHtml: false});
preventSubmit
By default, jqBootstrapValidtion will prevent forms from submitting if any of their elements fail validation by jqBootstrapValidation.
If you decide this isn't what you want, you can allow submitting of potentially invalid data for validation server-side (or in case you think someone might have a genuine case for exceptional data).$(...).jqBootstrapValidation({preventSubmit: false});
submitError
A javascript callback, used when a user is attempting to submit a form with invalid input.
Parameter | Description |
---|---|
$form | The form element which has the user attempted to submit (wrapped in jQuery) |
event | The submit event (note this may have already been cancelled before you receive it depending on your preventSubmit option). |
errors | An object consisting of the names of fields as keys, and the array of errors as values. |
submitSuccess
A javascript callback, used when a user is attempting to submit a form with valid input.
Parameter | Description |
---|---|
$form | The form element which has the user attempted to submit (wrapped in jQuery) |
event | The submit event (note this may have already been cancelled before you receive it depending on your preventSubmit option). |
autoAdd
If your form is missing help blocks, for example if you don't want an empty element hanging around near 'terms and conditions' check boxes where no explanation would normally be needed, jqBootstrapValidation will add them for you automatically.
If you decide this isn't what you want, for example if you only want the error styling without a warning message, you can stop jqBootstrapValidation from creating extra elements.$(...).jqBootstrapValidation({autoAdd: {helpBlocks: false}});
filter
jqBootstrapValidation doesn't assume anything about your form, so if you need to ignore some validators in multi-stage forms you can optionally filter them out of the submit event with the filter option.
6. EVENTS
validation.validation
Returns an array of validation errors for a given object.
If no errors are found, returns an empty array.
var errorMessages = []; $("...").each(function (i, el) { errorMessages = errorMessages.concat( $(this).triggerHandler("validation.validation") ); });
getValidators.validation
Returns the internal array of valiators for inspection.
var myValidators = $("...").first().triggerHandler("getValidators.validation");
7. METHODS
destroy
Removes all jqBootstrapValidation events attached to the given elements, and resets their control-block classes and help-block text to their original values.
$("...").jqBootstrapValidation("destroy");
collectErrors
Collects an object containing arrays of all error messages associated with each invalid element.
override
Overrides the internal array, to change the behaviour of default functions, add extra validators, and so on.
hasErrors
Returns true if the given collection of elements would show an error when submitted.