Friday, 9 June 2017

Mobile compatible development - disable all fields using JS - Microsoft Dynamics CRM - MoCA_Tip#3


Hello All,

Lets go though a quick tip on best practice around disabling all fields using JavaScript in MoCA.

Issue:
In traditional CRM JS development, we tend to use  getDisabled function to identify whether a control is disabled or not and setDisabled to enable or disable a field.

But in MoCA there are some controls which do not expose the above functions which result in JS error(not defined or not found).

Fix:
Before calling the function validate whether the function exist or not  and then call the same. By this way we can avoid unnecessary chaos in our JS.

Code Snippet:

if (control && control.getDisabled && !control.getDisabled()) {
   control.setDisabled(true);
}


Refer this blog for MoCA compatible disable all fields script

Don't forget to go through previous tips if you have missed,
  1. Form Selector and its usage

2 comments:

  1. Thanks For sharing this helpful and informative blog. I love the way that you describe the things. You are an incredible writer, Thank you so much for sharing the blog. Please keep sharing.
    Mobile Application Development
    Android App Development
    IOS App Development

    ReplyDelete
  2. Thanks Ankit! Appreciate your feedback!

    ReplyDelete

Contact Form

Name

Email *

Message *