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

Discussion

Discussion

Forms - Making the pesky AutoFill button be Automatic

posted on February 3, 2017

Continuing on the subject in this post about making the auto file automatic (https://answers.laserfiche.com/questions/48879/Auto-Fill-Button )

I have added the javascript with the for each function but only the first row is automatically populated. You still need to click the button manually on row 2+

I thought the For Each function was going to handle this. Am I missing something that is skipping the additional rows?

    $('.lookuptrigger input').change(tableAutofill);

    }
    function tableAutofill() {
        $('.cf-table-block tbody tr').each(function () {
            $(this).find('button.autofill').trigger('click');
        });
    }

0 0
replied on December 12, 2024

Anyone have the JavaScript version of this for the new designer? I have a stored procedure that puts the Auto Fill button on the form without asking if I want it there. Thanks!

0 0
replied on February 3, 2017

Try this one:

function autofill() {  
    $(this).closest("tr").find('button.autofill').trigger('click');
  }
  
  $('.lookupCondition select').on('change',autofill);
  $('.cf-table-add-row').click(function () {
    $('.lookupCondition select').on('change',autofill);
    $('.cf-table-block tr:last').find('button.autofill').trigger('click');
  });

 

0 0
replied on February 3, 2017

For some reason this function doesn't even populate the first row. I wish this button would just go away, the lookups normally  just run when data is populated into the specified fields. Here is my altered code, I just changed the name of the class to fit mine.

 

  function autofill() {  
    $(this).closest("tr").find('button.autofill').trigger('click');
  }
  
  $('.lookuptrigger select').on('change',autofill);
  $('.cf-table-add-row').click(function () {
    $('.lookuptrigger select').on('change',autofill);
    $('.cf-table-block tr:last').find('button.autofill').trigger('click');
  });

 

0 0
replied on February 3, 2017

I forgot that one triggers off of a drop-down field. That's where the .lookuptrigger select comes.

0 0
replied on February 3, 2017

Oh right! I missed that, going to try again

0 0
replied on February 3, 2017

Works perfectly! This is gold, I really didn't want to have to tell them they need to click an autofill button on only one form. Thanks so much!

0 0
replied on October 19, 2020

I realize I'm a few years late to this thread, but could this be repurposed to work for collections instead? I'm not well versed at all with JavaScript so I took my best stab at converting it, but clearly it didn't work otherwise I wouldn't be here :)

function autofill() {  
    $(this).closest("tr").find('button.autofill').trigger('click');
  }
  
  $('.lookuptrigger select').on('change',autofill);
  $('.cf-collection-append').click(function () {
    $('.lookuptrigger select').on('change',autofill);
    $('.cf-collection tr:last').find('button.autofill').trigger('click');
  });

We are unfortunately on version 10.2.0.834 so we don't have the option of removing the autofill button within the lookup rule itself and are having to code around it. I'm trying to get it to be auto-clicked upon changing a dropdown field (with the css class of "lookuptrigger" for each entry in a collection. Any help would be much appreciated!

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

Sign in to reply to this post.