From 97cb3a0586ee7e868a9f67184b046e65df5867dd Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Tue, 12 Jun 2012 16:46:36 +0000 Subject: [PATCH] If HTML5 validation fails, switch to the appropriate tab so message can be shown --- etemplate/js/etemplate.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/etemplate/js/etemplate.js b/etemplate/js/etemplate.js index 7d9cd2d10b..6f52ea4b1b 100644 --- a/etemplate/js/etemplate.js +++ b/etemplate/js/etemplate.js @@ -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');