Home
> CRM 2011, CRM 4.0, JScript > How to change CRM form field’s label text and color using Jscript
How to change CRM form field’s label text and color using Jscript
Hi,
Below is the sample JScript to change the color and text of CRM form field’s label; Place the code in JScript “onload” event
// To change color
if(crmForm.all.new_fieldname != null) {
var field = crmForm.all.new_fieldname_c; //”_c” is the caption (i.e.,Label)
if (field != null)
field.style.color = ‘gray’; //Specify your desired color
}
Same script work for both CRM 4.0 & CRM 2011
// To set the label
Xrm.Page.ui.controls.get(fieldname).setLabel(‘New label’);
🙂
Works great! Thank you so much!