EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: jega on September 01, 2023, 09:24:30 AM



Title: [SOLVED] Validation required show tab
Post by: jega on September 01, 2023, 09:24:30 AM
Hi.

On validation, how can i show the tab where the required textbox is ??


Jesper


Title: re: Validation required show tab
Post by: jega on September 01, 2023, 09:29:54 AM
Ohh, just found it in another topic


$('#ff').form('submit', {
   onSubmit: function(){
      var form = $(this);
      var isValid = form.form('validate');
      if (!isValid){
         var field = form.find('.validatebox-invalid:first');
         var panels = $('#tabs').tabs('tabs');
         for(var i=0; i<panels.length; i++){
            var panel = panels;
            if (panel.has(field).length){
               var index = $('#tabs').tabs('select', i);
               setTimeout(function(){
                  field.focus();
               },0)
               break;
            }
         }
      }
      
      return isValid;
   }
})