Hi,
I am trying to create a dropdown and a second field that populate from a sharepoint list. I have code below that works to do this but i also need to get the value of the dropdown.
fd.spRendered(function() {
//call function on from load
populateCategories2();
fd.field('DropDown2').$on('change', populateCategories2);
populateSpecDescription()
fd.field('Description2').$on('change', populateSpecDescription);
});//rendered ends
function populateCategories2() {
//specify your site URL and which columns are selected
var siteURL = '(SiteURL)';
let web = new Web(siteURL);
var selected = "";
selected = "Title,Address";
web.lists.getByTitle('(List Name)').items.select(selected).getAll().then(function(allItems) {
//console.log(allItems);
var valuesArray = [];
// add data object to array
allItems.forEach(function (element) {
valuesArray.push({value: element.Spec_Description, text: element.Spec_IDandName});
});
// set data source for dropdown
fd.field('DropDown2').widget.setDataSource(valuesArray);
fd.field('DropDown2').widget.setOptions({dataTextField: 'text', dataValueField: 'value'});
// reset fields
fd.field('Description2').value = "";
});
}function populateSpecDescription(){
// set spec fields
fd.field('Description2').value = fd.field('DropDown2').value;
}