Friday, April 15, 2011

Label in CRM 4.0

In CRM 4.0, if you want to add a Label on the form/in the section, the easiest way to achieve this would be, to add a text box, disable it and remove the border.

Add the below function in the on load of the form.
//For adding a label “Testing the heading”
ConvertControlToLabel( "new_textboxId"); // “new_textboxId” is the Id of a textbox

function ConvertControlToLabel( controlId ){ 
 var control = document.getElementById( controlId ); 

 if( control ){ 
  control.Disabled = true; 
  control.style.border = "0px"; 
 }
}
One other quick tip:
If you want to increase/decrease the width of the label to fit in to accommodate the label text in to one line, you can double click on the section and change the field width default value of 115 pixel to the appropriate you want.

NOTE: This is an unsupported way of implementation.