Created
May 12, 2016 14:30
-
-
Save anonymous/df806dcf8c960c1fa58d2256c6eeafb3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.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