Reputation: 1601
I would like to change the label for a text field. It should display E-mail in black, followed by a red asterisk. The code of the page is this one:
<td class="ms-crm-FieldLabel-LeftAlign FormSection_CellPadding ms-crm-Field-Required" id="emailaddress1_c">
<label for="emailaddress1">
E-mail
<img class="ms-crm-ImageStrip-frm_required" alt="Required" src="/_imgs/imagestrips/transparent_spacer.gif?ver=-657574203">
</label>
</td>
Is it possible to do it in CRM?
Upvotes: 0
Views: 1283
Reputation: 548
Crm has native support for making fields required.
You didn’t specify when you need the field to be required. the code below demonstrates both Making the field required when the form loads and when some other attribute needs to control the requirement.
var xrmPage = Xrm.Page;
var MyApp = MyApp || {};
/**
Bind to form onload
*/
function OnCrmPageLoad() {
/* Create a reference to the attribute that you want to make required */
MyApp.Attr1 = xrmPage.getAttribute("new_attribute1");
/* Create another reference to illustrate onchange event */
MyApp.SomeOtherAttr2 = xrmPage.getAttribute("new_someotherattribute");
/* Call requireAttribute1 when SomeOtherAttr2 changes */
MyApp.SomeOtherAttr2.addOnChange(requireAttribute1);
/* Call requireAttribute1 for the first time when the form loads */
MyApp.requireAttribute1();
}
/**
Make the my field required
*/
MyApp.requireAttribute1 = function () {
MyApp.Attr1.setRequiredLevel("required");
}
Upvotes: 0
Reputation: 353
You can use jQuery for this, but it is unsupported and not a good idea at all (past experience!)
If you need to have that functionality and it is more than just the one field it might be best to build an HTML web resource.
Nick
Upvotes: 1