I understand this feature will be available in an upcoming release but was wondering if a workaround exists.
After browsing answers.laserfiche I stumbled on Eric's code for populating a dropdown field and then using JavaScript to populate the table when a change occurs on the dropdown field.
However, I'd like to be able to populate this table as soon as the document loads and when I do this only the pre-lookup options show up.
Do look-ups only occur only when a user clicks on the drop down? Is there a way to trick this into loading?
Or what am I missing here =p
Behavior on field change:
.. then select drop down and desired result appears
Behavior on load:
Settings of drop down field:
Settings of Lookup:
Here is the code:
$(document).ready(function () {
// Modifies table row label based on drop down options populated from sql
function tableAwesome() {
var resultNumber = $('.filledField option').size();
for (var i = resultNumber -2; i > 0; i--) {
$('#q27').trigger('click');
}
for (var i = 1; i <= resultNumber; i++) {
var k = i+1;
$('td:contains("Row ' + i + '")').text($('.filledField option:nth-child(' + k + ')').text());
}
}
// Modifies when the dropdown field changes
$('.filledField').change(tableAwesome);
// Modifies on document load
//$(window).load(tableAwesome);
});
All require the drop down field to have the class "'filledField", a Lookup Rule w/o a condition, and q27 is the "add" button of the table element. Also change code commentary to flip between behavior handlers.