Thursday, May 28, 2009

Implementing Title Case using Java Script

Today I recieved a query to implement title case for the name fields in CRM.
This can simply be achieved by writing a custom Java Script method as below:
Add this code on the OnChange event of First Name attribute in Contact:

// JScript source code - TitleCase
var strTitleCase
var str = crmForm.all.firstname.DataValue
str.Substring(toUpperCase();
if(str != null)
{
strTitleCase = toTitleCase(str);
crmForm.all.firstname.DataValue = strTitleCase;
}
function toTitleCase(str)
{
return str.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});
}

3 comments:

  1. Hi ,

    Warm greetings from MasterMind Consulting!!!

    We are a corporate training organisation in Bangalore. We provide training services to major IT companies in India. We have a 2 to 3 days training requirement on

    “Microsoft CRM “

    for one of our clients. Kindly revert if you are interested to take up such freelance assignments.

    If yes kindly send us your profile and contact details to shalini@mastermindconsulting.in. Your quick response is appreciated. Kindly feel free to call me at 9845450603 for any clarifications

    Regards,
    Shalini

    ReplyDelete
  2. Really ,This is a wonderful post. I enjoyed the information lot. I will bookmark this page. Thanks for sharing this important information. Corporate Movie || Corporate Video Production || Ad Films Maker || Training Films

    ReplyDelete
  3. This article is efficient.Thank you for sharing it with us. I am visiting this blog on a daily basis and I am finding so much helpful article each time. Keep working on this and thank you once again.
    Microsoft Dynamics CRM Online Training

    ReplyDelete