The repeater is structured in this way:
Parent repeater
Category 1 (parent repeater row)
(Child repeater row)
Option 1
Option 2
etc...
Category 2 (parent repeater row)
(Child repeater row)
Option 1
Option 2
etc...
When loading the form, I call this function:
Code: Select all
// Make the PCS editable or readonly. Header and body can be made editable independently
function PCSEditable(headerEnabled,bodyEnabled) {
// toggle enabled because the call to setDisplayOnly expects true to make it read only or false to make it editable
headerEnabled=!headerEnabled;
bodyEnabled=!bodyEnabled;
// Header
for each (var ctrl in pages.Page_1.getControlsByModifier("PCSHEADER")){
ctrl.setDisplayOnly(headerEnabled);
}
var allSegments=tables.PCS_Template_Segments;
// Loop through all option groups
var allRows=tables.PCS_Template_OptionGroups;
var rows=allRows.getRows();
allSegmentRows=allSegments.getRows();
while (rows.next()) {
// Only process option groups for the current PCS Template ID
if (allRows.PCS_TemplateID.value != fields.PCSTEMPLATEID.value) {
continue;
}
// Jump to category that relates to the current category
parentRow=allSegments.findRow(allSegments.Segment_CategoryID,allRows.Segment_CategoryID.value);
if (parentRow != -1) {
allSegments.setCurrentRow(parentRow);
// This is the problematic line
allRows.OptionValues.fieldControl.setDisplayOnly(true);
}
}
fields.CUSTOMERINSTRUCTIONS.fieldControl.setDisplayOnly(bodyEnabled);
fields.GMSOFFICIALUSEONLY.fieldControl.setDisplayOnly(bodyEnabled);
// If body is editable, the save button needs to be visible
controls.SAVEBUTTON.setHidden(bodyEnabled);
controls.SAVEBUTTON_2.setHidden(bodyEnabled);
}
This field is set as a dropdown tied to a dynamic list set to to be built on each display and has a mapped field which is mapped to a column in a table resource.
If I comment out the problematic line the dropdown is visible and is selectable. There is no other code that affects the controls on the form.
I need help understanding why setting a control to display only hides it instead of making it read only.