web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Blogs / Dynamics CE Tech Blog / Enable/Disable the field pl...

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

gopi.royal999@gmail.com Profile Picture gopi.royal999@gmail... 430

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.

Comments

*This post is locked for comments