Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
.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