mirror of
https://github.com/e107inc/e107.git
synced 2025-08-06 06:38:00 +02:00
Switch to appropriate tab when html5 validation fails
This commit is contained in:
@@ -32,6 +32,27 @@ $(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;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user