Skip to content

Instantly share code, notes, and snippets.

Created May 12, 2016 14:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/df806dcf8c960c1fa58d2256c6eeafb3 to your computer and use it in GitHub Desktop.
Save anonymous/df806dcf8c960c1fa58d2256c6eeafb3 to your computer and use it in GitHub Desktop.
.on('success.field.fv', function(e, data) {
var $parent = null;
// If the field is empty
if (data.element.val() === '') {
$parent = data.element.parents('.form-group');
// Remove the has-success class
$parent.removeClass('has-success');
// Hide the success icon
data.element.data('fv.icon').hide();
}
if ($('.radio_button').is(':checked')) {
$parent = data.element.parents(this);
// Remove the has-success class
$parent.removeClass('has-feedback');
// Hide the success icon
data.element.data('fv.icon').hide();
}
}).on('success.form.fv', function(e) {
$('#btn-order').addClass('btn-disabled loading').text('Processing Order');
}).on('err.form.fv', function(e) {
// Get the FormValidation instance
var fv = $(e.target).data('formValidation');
// Get the first invalid field
var $firstInvalidField = fv.getInvalidFields()[0];
// Do something with first invalid field
$firstInvalidField.focus()
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment