1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-25 00:41:52 +02:00

Fixes #5230 Invalid element tab switch issue.

This commit is contained in:
camer0n
2024-04-05 17:01:30 -07:00
parent b432e20c6e
commit e4fa9eb83e
2 changed files with 14 additions and 7 deletions

View File

@@ -309,14 +309,14 @@ $(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('input:invalid,select:invalid,textarea:invalid').each(function(index, node) {
var tab = $('#'+node.id).closest('.tab-pane').attr('id');
$('#'+id).find('input:invalid, input.has-error,select:invalid,select.has-error, textarea:invalid, textarea.has-error').each(function(index, node) {
var tab = $(this).closest('.tab-pane').attr('id');;
if(tab && (found === false))
{
$('a[href="#'+tab+'"]').tab('show');

View File

@@ -454,8 +454,15 @@ $(document).ready(function()
$('#'+ id).find(':invalid').each(function (index, node) {
var tab = $('#'+node.id).closest('.tab-pane').attr('id');
// console.log(node.id);
// Attempt to find a parent '.tab-pane' for the invalid input.
var tabPane = $(node).closest('.tab-pane');
var tab = null;
// Check if '.tab-pane' was found.
if(tabPane.length > 0) {
// If found, get the id of the '.tab-pane'.
tab = tabPane.attr('id');
}
if(tab && (found === false))
{