If HTML5 validation fails, switch to the appropriate tab so message can be shown

This commit is contained in:
Nathan Gray 2012-06-12 16:46:36 +00:00
parent 06ff3cf08b
commit 97cb3a0586

View File

@ -9,6 +9,20 @@
* @version $Id$
*/
/**
* Handle HTML5 validation on tabs
*/
jQuery().ready(function() {
jQuery('.tab_body :input').bind('invalid', function(e) {
// Activate the appropriate tab
var tab = jQuery(this).parentsUntil('.tab_body').last();
var alltabs = [tab.attr("id")];
tab.siblings('div').each(function() {
alltabs.push(this.id);
});
activate_tab(tab.attr("id"), alltabs.join('|'));
});
});
function submitit(form,name)
{
//alert(name+' pressed');