function doesControlHaveAttribute(control) {
var controlType = control.getControlType();
return controlType != "iframe" && controlType != "webresource" && controlType != "subgrid";
}
function disableFormFields(onOff) {
Xrm.Page.ui.controls.forEach(function (control, index) {
if (doesControlHaveAttribute(control)) {
control.setDisabled(onOff);
}
});
}
function setupFormVisiblity()
{
var dependantControl = Xrm.Page.ui.controls.get("jmh_isrmsstockitem");
if ((dependantControl != "undefined") && (dependantControl != null))
var controlType = control.getControlType();
return controlType != "iframe" && controlType != "webresource" && controlType != "subgrid";
}
function disableFormFields(onOff) {
Xrm.Page.ui.controls.forEach(function (control, index) {
if (doesControlHaveAttribute(control)) {
control.setDisabled(onOff);
}
});
}
function setupFormVisiblity()
{
var dependantControl = Xrm.Page.ui.controls.get("jmh_isrmsstockitem");
if ((dependantControl != "undefined") && (dependantControl != null))
{
var attribute = dependantControl.getAttribute();
var depandantFieldValue = attribute.getValue();
//set visible based on depandant fields value
if (depandantFieldValue == true) //based on two option field
var attribute = dependantControl.getAttribute();
var depandantFieldValue = attribute.getValue();
//set visible based on depandant fields value
if (depandantFieldValue == true) //based on two option field
{
disableFormFields(true);
}
}
}
disableFormFields(true);
}
}
}
Note: call setupFormVisiblity javascipt method OnLoad Event of Form only..
No comments:
Post a Comment