These fields are returned to an Add page from an autofill based on a selected employees name.
I have a possible of 10 discipline incenents to return based on an employees history. Each of the 10 has 3 fields embeded in a section.
If an incedent is returned, I want to display the section, if one is not returned I want to hide the section.
Below is a sample of the code I'm trying to use. Currently it hides all the fields with or without data.
When I do an inspect in the browser and try to watch the field values, they show not available
is there a trick to see the value returned from an Autofill field?
Add Page
Javascript OnLoad event
var DISCIPLINE_DT5 = Runner.getControl(pageid, 'DISCIPLINE_DT5');
var DISCIPLINE_DT6 = Runner.getControl(pageid, 'DISCIPLINE_DT6');
// Block for Discipline 5
const dt5 = DISCIPLINE_DT5?.getValue?.();
if (dt5 && dt5.length >= 1) { // Changed 'value' to 'dt5'
pageObj.toggleItem("discipline5", true);
} else {
pageObj.toggleItem("discipline5", false);
}
// Block for Discipline 6
const dt6 = DISCIPLINE_DT6?.getValue?.();
if (dt6 && dt6.length >= 1) { // Changed 'value' to 'dt6'
pageObj.toggleItem("discipline6", true);
} else {
pageObj.toggleItem("discipline6", false);
}