excludeFromReadonly
This function allows you to specify controls that should remain editable even when readOnlyMode
is applied to the application. It's particularly useful for forms where most fields should be read-only, but specific fields need to remain editable.
Syntax
app.excludeFromReadonly(controlArray)
Parameters
Parameter | Type | Description |
---|---|---|
controlArray | Array | An array of control IDs to exclude from read-only mode |
Return Value
This function doesn't return a value.
Behavior
When you call this function, it sets a persistent list of controls that will be ignored by subsequent calls to readOnlyMode(true)
. This means:
- The specified controls remain editable even when the form is set to read-only mode
- This setting persists for the lifetime of the app instance or until overwritten
- Each call to this function replaces the previous exclusion list
Examples
Example 1: Basic usage in app startup event:
// In AppStart event: exclude specific controls from read-only mode
app.excludeFromReadonly(["firstName", "lastName"]);
// Later, when setting the form to read-only mode
app.readOnlyMode(true);
// firstName and lastName fields will remain editable
Example 2: Excluding multiple controls for a special form:
// Exclude specific fields in an address form
app.excludeFromReadonly(["adrNumber", "adrName", "adrCity"]);
// When read-only mode is activated, the specified fields remain editable
app.readOnlyMode(true);
Example 3: Updating the exclusion list:
// Initial exclusions
app.excludeFromReadonly(["firstName", "lastName"]);
// Later, replace with a different set of exclusions
app.excludeFromReadonly(["commentField", "statusField"]);
Notes
- This function is typically called once during app initialization (e.g., in the
AppStart
event) - The exclusion list is stored in the app's
excludedFromReadonly
property - When controls are excluded, they won't be affected by
readOnlyMode(true)
but will still respond tosetEnable()
calls - This setting has no effect when
readOnlyMode(false)
is called (all controls become editable) - For single-control exclusions, using the
options.exclude
parameter ofreadOnlyMode()
may be more appropriate