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

Question

Question

How to populate additional table line from the previous line data, also using lookup

asked on September 13, 2019 Show version history

I Have a table that is populate field by field base on choice of the previous table field.

when the first field is filled the user need to add a line and would like the majority of those field auto-populate from the previous line. I used the code below but it failed, when I added a line, it grab all the info and put it there but after 2 seconds from program filled, everything disappear.

The program field is a single-line field but filled as a list field by a lookup rule.

so I imagine the issue is there because the code works but it seems to be overwrite by the lookup rules to fill the field by the result from the lookup.

is there a way to bypass the lookup or force the code to wait that field is filled by the lookup before to set the new input with the content of the previous line.

and this need to be done at each time a new line is added

$(document).on('click', 'a.cf-table-add-row', function(e) {
    var _this = $('li.prevTable tbody tr:last'),
        _prev = _this.prev(),
        _field1 = _prev.find('td.BranchID input').val(),
        _field2 = _prev.find('td.TeamID input').val(),
        _field3 = _prev.find('td.Fund select').val(),       
    	_field4 = _prev.find('td.Program input').val(),
    	_field5 = _prev.find('td.AccountType select').val(),
   		_field6 = _prev.find('td.Account select').val();
    
    _this.find('td.BranchID input').val(_field1).trigger('change');
   	_this.find('td.TeamID input').val(_field2).trigger('change');
   	_this.find('td.Fund select').val(_field3).trigger('change'); 
    _this.find('td.Program input').val(_field4).trigger('change');
    _this.find('td.AccountType select').val(_field5).trigger('change');
    _this.find('td.Account select').val(_field6).trigger('change');
  });

 

 

0 0

Replies

replied on September 13, 2019

You could probably use javascript/jquery lookupstarted & lookupcomplete. The Laserfiche Administration Guide has some information on it.

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

Sign in to reply to this post.