CRM 2011


Hide the future dates in a CRM Calender control through Javascript

Scenario:

Suppose we have a date of birth field “dateofbirth” on the Contact form and we want to hide the future dates than the current date.

Solution:

create a function eg. myformload() and call this function on the onLoad event of the Contact form. The function myformload() is given below:

function myformload()
{
document.getElementById(‘dateofbirthimg’).onclick = showmyCalendar;
}

function showmyCalendar()
{
var today = new Date();
_dCalMaxDate = today;
InitCalendar(‘d/M/yyyy’, ‘/’, 0, _dCalMinDate, today);
LaunchCalendar(Xrm.Page.data.entity.attributes.get(“dateofbirth”), today, 1, false, today, null, 1, today);
}

I hope this helps.

Advertisements

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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: