Set Field to Read-Only

🚧 Set read-only option for a specified field.

1. Overview

This Interaction serves the purpose of making a field to be read-only.

2. Examples

These examples showcase how to implement the Interaction:

2.1. Example 1

In this example, if the Linked Quote field has a value, and then the Interaction sets the field's metadata to make it read-only.

async function handler(clev) {
    let returnCommands = { values: {}, fieldMeta: {} };
    let linkedQuote = clev.getValue("linked-quote");

    if (linkedQuote.length > 0) {
        returnCommands.fieldMeta["linked-quote"] = { readonly: true };
        return returnCommands;
    }
}

2.2. Example 2

In this example, the Interaction targets two fields: start-time and name. It sets the field metadata for both fields to make them read-only.

async function handler(clev) {
    let returnCommands = { values: {}, fieldMeta: {} };

    returnCommands.fieldMeta["start-time"] = { readonly: true };
    returnCommands.fieldMeta["name"] = { readonly: true };
    
    return returnCommands;
}

šŸ“Œ Need Help?

If you require assistance or encounter any issues, please don't hesitate to contact us for further support.