1
0
mirror of https://github.com/e107inc/e107.git synced 2025-03-14 01:19:44 +01:00

Switch to appropriate tab when html5 validation fails

This commit is contained in:
Cameron 2013-04-15 14:07:47 -07:00
parent 3058fc88d0
commit 42b41c500a

View File

@ -32,10 +32,31 @@ $(document).ready(function()
})
});
/* Switch to Tab containing invalid form field. */
$('input[type=submit],button[type=submit]').on('click', function() {
var id = $(this).closest('form').attr('id');
var found = false;
$('#'+id).find(':invalid').each(function(index, node) {
var tab = $('#'+node.id).closest('.tab-pane').attr('id');
if(tab && (found == false))
{
$('a[href="#'+tab+'"]').tab('show');
found = true;
//alert(node.id+' : '+tab);
}
// var label = $('label[for=' + node.id + ']');
})
return true;
});
// run tips on title attribute.
$(".e-tip").each(function() {