When a Lookup Rule Matches Multiple Single Line Fields within a Table the Auto Fill Button May Be Incorrectly Added to Rows

March 28, 2014 | KB: 1013463
Laserfiche Forms 9.1

Summary

If you create a lookup rule that matches multiple form fields with the database, an Auto Fill button will appear on the form, so that users can click this button to perform the lookup after they've filled in both fields required for the lookup. When this lookup rule matches single line fields within a repeatable table and additional rows are added, one or more Auto-Fill buttons will be incorrect added for each row.

Workaround 1

Use drop-down fields instead of single line fields for the lookup rule.

Workaround 2

You can also work around this issue using JavaScript to remove any additional Auto-Fill buttons that appear in the table. Users will still have to click the Auto Fill button for the first row to start the lookup. On the CSS and JavaScript page in the JavaScript section, paste the following code:

$(document).ready(function () {
$('.cf-table-add-row').click(function () {
$('tbody').find('button.autofill:not(:first)').remove();
});
});

You can also elect to hide the button and use JavaScript to automatically trigger the lookup after the fields are filled in. Because this method tries the lookup after each field is filled, it is not as efficient as manually pressing the button after each field is filled. See this question on the Answers site for more information.