EasyUI Forum
September 14, 2025, 08:23:12 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Select the parent tab of a required input & show validation message  (Read 10269 times)
devnull
Sr. Member
****
Posts: 431


View Profile
« on: March 25, 2015, 04:14:05 PM »

Hi;

How can I find the Parent Tab Index or Tab Text of an element in that tab.

For example if I have an input element and I want to find it's tab if how can I achiever that ?

« Last Edit: March 25, 2015, 08:09:34 PM by devnull » Logged

-- Licensed User --
devnull
Sr. Member
****
Posts: 431


View Profile
« Reply #1 on: March 25, 2015, 07:55:42 PM »

I am trying to select the parent TAB of a REQUIRED input which failed validation and then show the "This field is Required" message for that field.

The following code successfully gets the tab object, selects the tab of the field, but I cannot seem to get the "This filed is required" message to show next to the input after enabling the tab ?

I have tried inv.prev('input').textbox('validate'); but that does not appear to work ?

Code:
    function eltaben(inv){
      var tab = $(inv).closest('.tabs-panels');
      var tob = tab.parent('.tabs-container');
      tab.children('.panel').each(function(){
        var me = $(this);
        if(me.find(inv).length > 0) {
          tob.tabs('select',me.index());
        }
      })      
    }
    var vali = me.form('validate');
    if(!vali) {
      var vis = $(this).find('.textbox-invalid:visible').first();
      if(vis.length ==0) {
        var inv = $(this).find('.textbox-invalid:hidden');
        eltaben(inv);
        inv.prev('input').textbox('validate');
      }
« Last Edit: March 25, 2015, 08:06:21 PM by devnull » Logged

-- Licensed User --
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #2 on: March 26, 2015, 04:01:31 AM »

Please notice this statement.
var vali = me.form('validate');

The 'me' is a <DIV> object, you need to get the 'form' object before calling the 'validate' method, please try to use the code below instead.
var vali = me.find('form').form('validate');
Logged
devnull
Sr. Member
****
Posts: 431


View Profile
« Reply #3 on: March 26, 2015, 04:26:18 AM »

Sorry, you misunderstand the question.

I have now solved most of the problems, the only problem remaining now is how do I trigger the "This Field is required" on a specific input.

Form validate will always goto the first element that failed validation, but in this case the element is hidden in an unselected tab.

All I need to know now is how can I trigger the "This Filed is Required" programatically after I enable the tab and show the hidden input.

Thanks
Logged

-- Licensed User --
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!