Is anybody out there who could guide me please? With the help of this post "(javascript) How do I populate data into fields based on a selection picked in a look up column? " I was able to populate single line text box, drop down and date fields but I am stuck with radio button, multi checkbox and multi line text box fields to get populated based on lookup field change. Radio button and Multi checkbox fields are getting values though, I test it with "alert" as you can see below.
NWF$(document).ready(function () {
var obj = NWF$("#" + LookupProject);
obj.change(function () {
var clientContext = SP.ClientContext.get_current();
var web = clientContext.get_web();
var oList = clientContext.get_web().get_lists().getByTitle("DetailReport");
var listItem = oList.getItemById(itemID);
clientContext.load(listItem, "Name", "Project", "Department", "StartDate", "RadioButton", "MultiCheckbox", "MultiLineTB");
clientContext.executeQueryAsync(function () {
document.getElementById(varName).value = listItem.get_item('Name'); document.getElementById(varProject).value = listItem.get_item('Project'); document.getElementById(varDepartment).value=listItem.get_item('Department'); document.getElementById(varStartDate).value=listItem.get_item('StartDate').format('MM/dd/yyyy');
document.getElementById(varRadioButton).value=listItem.get_item('RadioButton');
alert(NWF$('#' + varRadioButton).val()); // This is showing me right value but it is not checking the radio button.
I tried
listItem.get_item('RadioButton').prop('checked', true);
and IF
if (NWF$('#' + varRadioButton).is(':checked') === false){
NWF$('#' + varRadioButton).prop('checked', true);}but its not working
document.getElementById(varMultiCheckbox).value=listItem.get_item('MultiCheckbox'); //same issue as above
document.getElementById(varMultiLineTB).value=listItem.get_item('MultiLineTB'); // Not working obviously }, function () {
});
});
});