In order to change a fields label, we need to modify the fieldname_c.innerText property. Take for example the following example where we have 'Project Category' and 'Project Manager' attributes:
Now for the sake of argument, say I want to rename my 'Project Manager' attribute based upon the option selected in the 'Project Category' attribute. I would have to put the following code in to the form's onLoad and attributes onChange events:
//only do something if there is data in the attribute
if (crmForm.all.new_projectcategory.DataValue != null) {
//get the attribute value
var pCat = crmForm.all.new_projectcategory.DataValue;
//work through the values
switch (pCat) {
case "1": crmForm.all.ownerid_c.innerText = "Project Manager";
break;
case "2": crmForm.all.ownerid_c.innerText = "Project Administrator";
break;
}
}
Eureka! Now when I set my Project Category value, I get different names on the Owner attribute label...

No comments:
Post a Comment