답변 4개
To achieve in using validation rules:
Set the criteria to fire when the checkbox is unchecked (FALSE) and the text field is changed. The formula might look like this:
AND(
NOT(Checkbox_Field__c),
ISCHANGED(Text_Field__c)
)
Using Lightning Web Components
handleChange(event) {
// This correctly captures whether the checkbox is checked or not.
this.isTextFieldEditable = event.target.checked;
}
exampel:
<lightning-input type="checkbox" label="Enable Editing" onchange={handleChange}></lightning-input>
<!-- Use the `not` operator (!) to inverse the boolean value for the `disabled` attribute -->
<lightning-input type="text" label="Editable Text Field" disabled={!(isTextFieldEditable)}></lightning-input>
check below article: