Enable/Disable the field placed in multiple places on the form

Hi Everyone,

Today I was writing JavaScript code to disable the field on some condition and observed that the field is not getting disabled. I was little surprised and tried with some other field and it worked perfectly. By this, I understand that there is some problem with this field and after some search understood that the same field has been placed on other tabs as well.

To fix it, we just have apply loop through the control. Here is the sample code for the same.

formContext.getAttribute("SchemaName").controls.forEach(
function (control, i) {
control.setDisabled(true);
});

Hope this helps.


Happy 365’ing
Gopinath.

One thought on “Enable/Disable the field placed in multiple places on the form

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s