FormValidation v0.8.1 is released, supports Bootstrap 4 alpha 3

News

The latest news about FormValidation

FormValidation v0.6.3 Released

New features

  • #109: Add prevalidate.form.fv event that is triggered before validating the form

Improvements

  • #92: Improve Dutch national identification number (BSN) validator. It doesn't accept numbers which have less than 8 digits
  • #99: Add the date to return value of the date validator. We can reuse it for additional job
  • #130: The remote validator supports using $field and value in data/url callbacks
  • The isbn validator adds ISBN type to the return value
  • The ismn validator adds ISMN type to the return value

Bug fixes

  • #102: Fix an issue on IE 10/11 that causes an input element with placeholder attribute to be validated automatically when it's focused
  • #148: Fix an issue that causes the validating icon to not shown when the field is being validated

Document

Download

FormValidation v0.6.2 Released

Highlight

  • Add new promise validator
  • Add STATUS_IGNORED status. The field will be ignored for the current validation if the validator returns null

New features

  • iban validator adds new sepa option that requires the IBAN number must be (or not) from the SEPA countries
  • iban validator now supports East Timor, Kosovo countries

Improvements

  • date validator supports dot (.) separator for European countries
  • #57, #82: iban validator will return false if the country is not supported
  • #62: Allow to use callback for field's excluded option
  • #91: Skip validation on button using formnovalidate attribute
  • Add more examples for iban test suite
  • The field container and its feedback icon don't have success/error class if all field validators are disabled

Bug fixes

  • #47: Spanish VAT validator doesn't work with some examples
  • #48: Override the options when adding field
  • #50: The Brazilian ID (CPF) number must have 11 digits
  • The updateMessage() method must return the plugin instance for chaining
  • When calling resetField(true) and resetForm(true) methods, the field need be reset value before updating the status

Document

Download

FormValidation v0.6.1 Released

Highlight

  • #467: Add dataType, crossDomain, validKey options for remote validator.

It's possible to use remote validator to connect to external validator API, such as MailGun (#1315).

  • #1357: In addition to Bootstrap, Foundation, Pure, Semantic, UIKit, v0.6.1 provides the ability of supporting custom framework

New features

Improvements

  • #1327: remote validator fails if Ajax request fails
  • #1427: Update Netherlands phone number validator, thanks to @DiederikLascaris
  • Add plugin instance to the 3rd parameter of transformer callback
  • Add Grunt task that runs the jasmine test suites

Bug fixes

This version fixed the isValid() method which should return null when there is not validated or being validated field. It also solves the issues where the submit button is disabled even when the form is valid.

  • #962, #1318: remote validator and isValid() combined do not work
  • #1160: Submit button is disabled
  • #1171: Submit button being disabled
  • #1220: Can only submit form after changing a value
  • #1221, #1344: Remote validation trigger err.form.fv
  • #1394: Submit incorrectly enabled even though form has errors

Other issues are fixed in this version:

  • #1107, #1279, #1280, #1419: Show the validating icon when the field is being validated
  • #1282: Reset checkbox when calling resetForm() method
  • #1320: Fix Slovakia phone number validator
  • #1343, #1369: Fix the issue where custom validator doesn't provide default message
  • #1379: Don't continue if there is no validators attached to fields
  • #1387: transformer option doesn't work with notEmpty validator
  • #1389: Fix isValidContainer() and validateContainer() methods to support fields with the same name

Document

Language packages

  • #1381: Update Slovak language package, thanks to @PatrikGallik
  • #1400: Update Belgian Dutch language package, thanks to @jdt
  • #1432: Fix some typos in the Hungarian translation, thanks to @blackfyre

Download

Upgrading to v0.6.0

From v0.6.0, the plugin name is changed to FormValidation. To upgrade from v0.5.3 to v0.6.0, perform the following steps:

Required Step: Changing CSS, Javascript paths

This step is required.

v0.5.3:
<!-- Path to Bootstrap CSS v3.0.0 or higher -->
<link rel="stylesheet" href="/vendor/bootstrap/css/bootstrap.min.css">

<!-- Path to BootstrapValidator CSS -->
<link rel="stylesheet" href="/vendor/bootstrapvalidator/dist/css/bootstrapValidator(.min).css">

<!-- jQuery v1.9.1 or higher -->
<script type="text/javascript" src="/vendor/jquery/jquery.min.js"></script>

<!-- Path to Bootstrap JS -->
<script src="/vendor/bootstrap/js/bootstrap.min.js"></script>

<!-- Path to BootstrapValidator JS -->
<script type="text/javascript" src="/vendor/bootstrapvalidator/dist/js/bootstrapValidator(.min).js"></script>
v0.6.0:
<!-- Path to Bootstrap CSS v3.0.0 or higher -->
<link rel="stylesheet" href="/vendor/bootstrap/css/bootstrap.min.css">

<!-- FormValidation CSS file -->
<link rel="stylesheet" href="/vendor/formvalidation/dist/css/formValidation(.min).css">

<!-- jQuery v1.9.1 or higher -->
<script type="text/javascript" src="/vendor/jquery/jquery.min.js"></script>

<!-- Path to Bootstrap JS -->
<script src="/vendor/bootstrap/js/bootstrap.min.js"></script>

<!-- FormValidation plugin and the class supports validating Bootstrap form -->
<script src="/vendor/formvalidation/dist/js/formValidation(.min).js"></script>
<script src="/vendor/formvalidation/dist/js/framework/bootstrap(.min).js"></script>

Don't confuse bootstrap(.min).js file provided by the Bootstrap framework with bootstrap(.min).js provided by FormValidation which is placed inside the formvalidation/dist/js/framework directory.

They are two different files and both of them need to be included as mentioned above.

Required Step: Changing your own validator

You can ignore this step in case you don't have any your own validators. Otherwise, change its declaration as following:

v0.5.3:
(function($) {
    $.fn.bootstrapValidator.validators.yourValidatorName = {
        validate: function(validator, $field, options) {
            ...
        }
    };
}(window.jQuery));
v0.6.0:
(function($) {
    FormValidation.Validator.yourValidatorName = {
        validate: function(validator, $field, options) {
            // ...
            // The validation code is the same
        }
    };
}(window.jQuery));

Optional Step: Calling plugin

After completing the steps above, you can call the plugin by both programmatic and declarative usages as before.

Using v0.5.3 options as your current one are supported in all v0.6.x releases. It means that you will have a lot of time to upgrade your code while current one still work.

Anyway, it is recommended to change the plugin calling, options which are listed as following:

Attribute

v0.5.3 v0.6.0
Using data-bv-xxx attribute Using data-fv-xxx attribute

Form settings

v0.5.3 v0.6.0
container err.container
feedbackIcons icon
group row.selector
submitButtons button.selector
Example
$(form).bootstrapValidator({
    container: 'tooltip',
    feedbackIcons: {
        valid: '...',
        invalid: '...',
        validating: '...'
    },
    group: 'td',
    submitButtons: '#submitButton'
});
$(form).formValidation({
    framework: 'bootstrap',
    err: {
        container: 'tooltip'
    }
    icon: {
        valid: '...',
        invalid: '...',
        validating: '...'
    },
    row: {
        selector: 'td'
    },
    button: {
        selector: '#submitButton'
    }
});

Field settings

v0.5.3 v0.6.0
container err
feedbackIcons icon
group row
Example
$(form).bootstrapValidator({
    fields: {
        fieldName: {
            container: 'tooltip',
            feedbackIcons: false,
            group: '.col-sm-3',
            validators: {
                ...
            }
        }
    }
});
$(form).formValidation({
    framework: 'bootstrap',
    fields: {
        fieldName: {
            err: 'tooltip',
            icon: false,
            row: '.col-sm-3',
            validators: {
                ...
            }
        }
    }
});

Events

There are two changes about the event names:

  • The namespace .bv is changed to .fv
  • The namespace error. is changed to err. to avoid window.onerror being invoked by jQuery
v0.5.3 v0.6.0
Form events
init.form.bv init.form.fv
error.form.bv err.form.fv
success.form.bv success.form.fv
added.field.bv added.field.fv
removed.field.bv removed.field.fv
Field events
init.field.bv init.field.fv
error.field.bv err.field.fv
success.field.bv success.field.fv
status.field.bv status.field.fv
Validator events
error.validator.bv err.validator.fv
success.validator.bv success.validator.fv

The last thing, the hexColor validator, deprecated in v0.5.3, is replaced with color validator.

FormValidation v0.6.0 Released

New name

From v0.6.0, the plugin has new name: FormValidation. It supports validating form created by many frameworks including

Upgrading guide shows the step by step instructions to upgrade from v0.5.3 to v0.6.0

Highlight

  • #744: Add transformer option, allowing to hook the value of field before validating
  • #1131: Support add-on
  • #1204: Support Zurb Foundation framework
  • #1210: Support UI Kit framework
  • #1211: Support Semantic UI framework
  • #1212: Support Pure framework

New features

Changes

  • #1167: Remove hexColor validator. Use color validator instead
  • #1272: Change event error.x.x to err.x.x to avoid window.onerror being invoked by jQuery
  • Remove tab behavior from base class

Improvements

  • #883: Look for the field inside form first when using selector, thanks to @drebrez
  • #908, #1156: Add allowEmptyProtocol option to set optional protocol in uri validator, thanks to @krecik
  • #914, #1035, #1163: Improve identical validator, thanks to @jazzzz
  • #1037: Show the credit card icon based on its type
  • #1083, #1092: Showing tooltip/popover when moving over or clicking the feedback icon (Bootstrap 3.3.0), thanks to @Arkni
  • #1137: Use jQuery instead of window.jQuery
  • #1154: Allow to reuse data which is returned by the validator
  • #1177: Don't need to set the different validator for both fields
  • #1186, #1188: Improve the CPF validator, thanks to @igorescobar
  • #1197: Add sample data for CPF validator, thanks to @dgmike
  • #1207: Improve Spanish phone validator, thanks to @ethernet-zero
  • #1218: Improve Slovenian vat number validator, thanks to @Glavic
  • #1224: Improve tooltip style when working with Semantic UI form, thanks to @Arkni
  • #1226: Fix destroying Semantic UI popup, thanks to @Arkni
  • #1239: Fix typo in UIKit class, thanks to @Arkni
  • #1252: Validators return true for not supported countries
  • #1255, #1258: Support to use a Date object as value for min and max options, thanks to @Arkni
  • #1261: Improve cvv validator
  • #1268: uri validator gets slower if more than 25 characters
  • The isValidContainer() method should return null if the container consists of at least one field which is not validated yet or being validated

Bug fixes

  • #1101: The cusip validator doesn't work
  • #1102: Fix the date validator issue where accepts 2014-11-1 23: as valid YYYY-MM-DD h:m date
  • #1105: The color validator doesn't provide html5Attributes mapping
  • #1125, #1136: Update Brazil ID validator to support working with Mask plugin, thanks to @jonasesteves
  • #1243: Fix the icon without label class
  • #1267: identical validator allows to compare with any input
  • #1274: Fix validateContainer() to use map value instead of key, thanks to @jasonblalock
  • #1279, #1280: Show the validating icon when the field is being validated, thanks to @tmaly1980
  • #1292: Fix bug of US phone number validator

Document

Language packages

  • #1150: Add Catalan language package, thanks to @ArnauAregall
  • #1216, #1248: Add Slovak language package, thanks to @budik21
  • #1217, #1247: Update Czech language package, thanks to @budik21
  • #1225: Add Finnish language package, thanks to @traone
  • #1246: Add Hindi language package, thanks to @gladiatorAsh
  • #1321: Add Basque language package, thanks to @xabikip

Contributors

Thanks to contributors:

Download