I want to create a Title based on the contents of two fields: the Year and the SCBA. Here is my code:
fd.spRendered(function() {
let yr = new Date().getFullYear();
fd.field('DropDown1').widget.setDataSource({data:[yr,yr + 1]});
fd.field('DropDown1').$on('change', function(value) {
fd.field('Year').value = value;
fd.field('Title').value = fd.field('SCBA').value.LookupValue + '-' + value;
});
});
This works just fine after the form has been submitted once. The problem is getting the LookupValue on a new form returns blank. I tried to get at the text of the lookup field using the Widget object but I couldn't figure that out.