CSL field value not being set
Posted: 05 Sep 2017
Hello,
I am trying to setup a CSL field that points to a user field in another list in the same site. The CSL field displays the list of approvers but when I select a name the CSL field does not update.
I added the following alerts to the CSL field's onchange event,
-- alert(fd.field("FBA").value());
-- alert(fd.field('FBA').control('data')['Title']);
It returns 1 for the value, which is the correct item id of the item I selected. It returns blank for the Title. And the field does not get populated.
This is the JS from my CSL field.
Request items:
function (term, page) {
if (!term || term.length == 0) {
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id," +
"{LookupField},Approver/Title&$expand=Approver&$orderby=Created desc&$top=10";
}
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id," +
"{LookupField},Approver/Title&$expand=Approver&" +
"$filter=startswith({LookupField}, '" + encodeURIComponent(term) + "')&$orderby=Created desc&$top=10";
}
Item format:
function(item) {
return '<span class="csl-option">' + item["Approver"].Title + '</span>'
}
Thank you for your help.
I am trying to setup a CSL field that points to a user field in another list in the same site. The CSL field displays the list of approvers but when I select a name the CSL field does not update.
I added the following alerts to the CSL field's onchange event,
-- alert(fd.field("FBA").value());
-- alert(fd.field('FBA').control('data')['Title']);
It returns 1 for the value, which is the correct item id of the item I selected. It returns blank for the Title. And the field does not get populated.
This is the JS from my CSL field.
Request items:
function (term, page) {
if (!term || term.length == 0) {
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id," +
"{LookupField},Approver/Title&$expand=Approver&$orderby=Created desc&$top=10";
}
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id," +
"{LookupField},Approver/Title&$expand=Approver&" +
"$filter=startswith({LookupField}, '" + encodeURIComponent(term) + "')&$orderby=Created desc&$top=10";
}
Item format:
function(item) {
return '<span class="csl-option">' + item["Approver"].Title + '</span>'
}
Thank you for your help.