This question is similar to this one, I am just updating the question with the field names, also I am not using a business rule because I used the maximum number
- If "Is today a holiday?" Equals Yes
- Show "Describe the holiday"
- Required "Describe the holiday"
- Else
- Hide "Describe the Holiday"
- Not Required "Describe the Holiday"
The field "Is today a holiday" is an option set with Yes and No. The default value is blank
The field "Describe the holiday" is a text field
- function onLoad() {
- Test("new_istodayaholiday");
- }
- function new_istodayaholidayOnChange() {
- Test("new_istodayaholiday");
- }
- function Test(fieldName) {
- var checked = Xrm.Page.getAttribute(fieldName).getValue();
- var required = checked ? "required" : "none";
- Xrm.Page.getControl("new_describetheholiday").setVisible(checked);
- Xrm.Page.getAttribute("new_describetheholiday").setRequiredLevel(required);
- }
I tried the above code as suggested on the previous post, but I am getting this error:
TypeError: Cannot read property 'setVisible' of null
I really appreciate the help.
*This post is locked for comments