Defaulting a field and setting disabled on the form load; changing a text field value based on the other picklist field value.
function feeevent() {
var
feeattrib = Xrm.Page.getAttribute("new_fee");
var
feecontrl = Xrm.Page.getControl("new_fee");
feeattrib.setValue("$ 400");
feecontrl.setDisabled(true);
}
function bandevent() {
var
picklistOne = Xrm.Page.getControl("new_chargingband");
var
picklistOneAttribute = picklistOne.getAttribute();
var
picklistOneSelectedOption = picklistOneAttribute.getSelectedOption();
var
picklistOneSelectedText = "";
var
feecontrl = Xrm.Page.getControl("new_fee");
var
feeattrib = Xrm.Page.getAttribute("new_fee");
if
(picklistOneSelectedOption != null) {
picklistOneSelectedText =
picklistOneSelectedOption.text;
}
if
(picklistOneSelectedText != null &&
picklistOneSelectedText != "") {
if
(picklistOneSelectedText == "Micro")
{
feecontrl.setDisabled(false);
feeattrib.setValue("$ 400");
feecontrl.setDisabled(true);
}
if
(picklistOneSelectedText == "Small")
{
feecontrl.setDisabled(false);
feeattrib.setValue("$ 800");
feecontrl.setDisabled(true);
}
if
(picklistOneSelectedText == "Medium")
{
feecontrl.setDisabled(false);
feeattrib.setValue("$ 1600");
feecontrl.setDisabled(true);
}
if
(picklistOneSelectedText == "Large")
{
feecontrl.setDisabled(false);
feeattrib.setValue("$ 2400");
feecontrl.setDisabled(true);
}
}
}
No comments:
Post a Comment