You are viewing limited content. For full access, please sign in.

Discussion

Discussion

For each row is finding invisible rows in Laserfiche Forms Talbes

posted on December 1, 2017 Show version history



  
  $('li.table').on('change', '.dept select', SetDepartTime);
                  
  function SetDepartTime() {
    var d = new Date();
    
        $('li.table tbody tr').each(function () {
            var current = $(this).find('.time input').val(); 
          
          alert(current);
          
            });
  }

Thought I had this solved, but javascript is still finding rows that don't exist on the form. For example, the form only has 1 table with 1 row, and this .each function runs 3 times. I am looking for a function that only runs once per row.

0 0
replied on December 3, 2017

Have you tried running the loop on the input field its self?

 

('li.table').on('change', '.dept select', SetDepartTime);
                  
  function SetDepartTime() {
    var d = new Date();
    
        $('li.table tbody tr .time input[type=text]').each(function () {
            var current = $(this).val(); 
          
          alert(current);
          
            });
  }

 

0 0
replied on December 4, 2017

Looking to work with all of the fields for that row in each loop. The problem is the loop is running 3-6 times, per row.

0 0
replied on December 4, 2017

Ok, give this a shot.

 $('li.table').on('change', '.dept select', SetDepartTime);
                  
  function SetDepartTime() {
    var d = new Date();
    
        $('table.li>tbody>tr').each(function () {
            var current = $(this).find('.time input').val(); 
          
          alert(current);
          
            });
  }

This assumes li is the class assigned to the table.

0 0
replied on December 11, 2017

the table class is "table", "li" is the name of the built in element. On this post, Rui explained that if you do not call the element, all your code runs twice. For awhile this was working for me, recently on every project I touch, li.table runs at least twice. I just need a method that runs once per row, I can't see any use in executing the same code multiple times.

 

https://answers.laserfiche.com/questions/124991/javascript-tableonchange-input-function-should-only-trigger-when-the-value-of-the-field-changes#125456

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.