Skip to content

Commit

Permalink
Update index.ts , handle Disabled (ReadOnly) status
Browse files Browse the repository at this point in the history
Quick Patch to react to Disabled/Enabled status change when it's modified via JS on the form.
  • Loading branch information
DarkyShadoW authored Aug 18, 2023
1 parent 7938cfa commit 0658c0b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion CustomSwitch/CustomSwitch/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,12 @@ export class CustomSwitch implements ComponentFramework.StandardControl<IInputs,

this.ensureLabel((<HTMLInputElement>document.getElementById(this._checkboxid)).checked);
}

if (context.mode.isControlDisabled) {
(<HTMLInputElement>document.getElementById(this._checkboxid)).setAttribute("disabled", "disabled");
}else{
(<HTMLInputElement>document.getElementById(this._checkboxid)).removeAttribute("disabled")
}
}

/**
Expand All @@ -160,4 +166,4 @@ export class CustomSwitch implements ComponentFramework.StandardControl<IInputs,
{
// Add code to cleanup control if necessary
}
}
}

0 comments on commit 0658c0b

Please sign in to comment.