Friday, April 1, 2011

No Calendar when Enabling DateTime fields via Javascript

I ran into an annoying problem today. I was enabling and disabling a DateTime field via Javascript via the following code:

Xrm.Page.getControl("new_datetimefield").setDisabled(true/false);

However, even when enabled, the calendar button did not function and I couldn't put any dates in the text box.

It turns out that this is a bug in CRM2011 - The fix is to ensure that the DateTime field is enabled by default on the form, then disable or enable via Javascript. If it is initially disabled, it will not be properly editable even when enabled via Javascript.

No comments:

Post a Comment