function doOnLoad() {
empinfo = [
{
type: “block”, label: “”, inputWidth: 950, list: [
{ type: "input", label: "<span class='labelMandatoryClass'>Employee ID :</span>", name: "txtEmpID", labelWidth: 150, value: "", inputWidth: 200, maxLength: getMaxFieldLengthByName("Code"), validate: "NotEmpty" },
{ type: "input", label: "<span class='labelMandatoryClass'>Employee Name :</span>", name: "txtEmpName", labelWidth: 150, value: "", inputWidth: 200, maxLength: getMaxFieldLengthByName("Name"), validate: "NotEmpty" },
{ type: "input", label: "Nick Name :", name: "txtNickName", labelWidth: 150, value: "", maxLength: getMaxFieldLengthByName("Name"), inputWidth: 200 },
{ type: "combo", label: "<span class='labelMandatoryClass'>Designation :</span>", name: "cboDesign", labelWidth: 150, value: "", inputWidth: 200, validate: "NotEmpty" },
{ type: "combo", label: "<span class='labelMandatoryClass'>Nationality :</span>", name: "cboNationality", labelWidth: 150, value: "", inputWidth: 200, validate: "NotEmpty" },
{ type: "combo", label: "<span class='labelMandatoryClass'>Employee Type :</span>", name: "cboOTGroup", labelWidth: 150, value: "", inputWidth: 200, validate: "NotEmpty" },
{ type: "combo", label: "Auto Day Change :", name: "cboAutoDayChange", labelWidth: 150, value: "", inputWidth: 200 },
{ type: "input", label: "Schedule Cap Hours(SCH)", name: "txtScheduleWeeklyCap", labelWidth: 150, value: "", inputWidth: 200, maxLength: getMaxFieldLengthByName("Hours"), validate: "CheckNumWithTwoDecimalPlace_Decimal" },
{ type: "input", label: "Remark :", name: "txtRemark", labelWidth: 150, value: "", maxLength: getMaxFieldLengthByName("Remark"), inputWidth: 200 },
]
}
];
employeinfo = new dhtmlXForm(“employeinfo”, empinfo);
employeinfo.enableLiveValidation(true);
cboCategory = employeinfo.getCombo(“cboCategory”);
cboCategory.enableFilteringMode(true);
cboCategory.setOptionWidth(300);
cboCategory.load(“RTHandler.ashx/?type=cboCategory”);
cboCategory.attachEvent(“onChange”, function (val) {
});
cboCategory.attachEvent("onXLE", function (value, text) {
});
cboCategory.attachEvent("onClose", function (value, text) {
});
cboCategory.setFilterHandler(function (mask, option) {
var r = false;
if (mask.length == 0) {
r = true;
} else if (option.text.match(new RegExp(mask, "i")) != null) {
r = true;
}
return r;
});
cboNationality = employeinfo.getCombo("cboNationality");
cboNationality.enableFilteringMode(true);
cboNationality.setOptionWidth(300);
cboNationality.load("RTHandler.ashx/?type=cboNationality");
cboNationality.attachEvent("onChange", function (val) {
//cboDesign.setComboText("");
});
cboNationality.attachEvent("onXLE", function (value, text) {
//CheckedAllReason();
});
cboNationality.attachEvent("onClose", function (value, text) {
});
cboNationality.setFilterHandler(function (mask, option) {
var r = false;
if (mask.length == 0) {
r = true;
} else if (option.text.match(new RegExp(mask, "i")) != null) {
r = true;
}
return r;
});
cboDesign = employeinfo.getCombo("cboDesign");
cboDesign.enableFilteringMode(true);
cboDesign.setOptionWidth(300);
cboDesign.load("RTHandler.ashx/?type=cboDesignation");
cboDesign.attachEvent("onChange", function (val) {
//cboDesign.setComboText("");
});
cboDesign.attachEvent("onXLE", function (value, text) {
//CheckedAllReason();
});
cboDesign.attachEvent("onClose", function (value, text) {
});
cboDesign.setFilterHandler(function (mask, option) {
var r = false;
if (mask.length == 0) {
r = true;
} else if (option.text.match(new RegExp(mask, "i")) != null) {
r = true;
}
return r;
});
cboOTGroup = employeinfo.getCombo(“cboOTGroup”);
cboOTGroup.enableFilteringMode(true);
cboOTGroup.setOptionWidth(300);
cboOTGroup.load(“RTHandler.ashx/?type=cboEmpType”);
cboOTGroup.attachEvent("onChange", function (val) {
//cboDesign.setComboText("");
});
cboOTGroup.attachEvent("onXLE", function (value, text) {
//CheckedAllReason();
});
cboOTGroup.attachEvent("onClose", function (value, text) {
});
cboOTGroup.setFilterHandler(function (mask, option) {
var r = false;
if (mask.length == 0) {
r = true;
} else if (option.text.match(new RegExp(mask, "i")) != null) {
r = true;
}
return r;
});
cboAutoDayChange = employeinfo.getCombo("cboAutoDayChange");
cboAutoDayChange.enableFilteringMode(true);
cboAutoDayChange.setOptionWidth(300);
cboAutoDayChange.load("RTHandler.ashx/?type=cboAutoDayChange");
cboAutoDayChange.attachEvent("onChange", function (val) {
//cboDesign.setComboText("");
});
cboAutoDayChange.attachEvent("onXLE", function (value, text) {
//CheckedAllReason();
});
cboAutoDayChange.setFilterHandler(function (mask, option) {
var r = false;
if (mask.length == 0) {
r = true;
} else if (option.text.match(new RegExp(mask, "i")) != null) {
r = true;
}
return r;
});
cboAutoDayChange.attachEvent("onClose", function (value, text) {
});
reloadDataToShow();
}
function reloadDataToShow() {
var queryString = getParameterByName(‘Parameter’);
if (queryString != ‘null’ && queryString != null) {
//debugger;
var code = employeinfo.getItemValue(“txtEmpID”);
if (code != “”) {
box = dhtmlx.modalbox({
text: “Loading, Please Wait…”,
width: “300px”
});
var listArguments = new Array();
listArguments[0] = 'Edit@' + code;
GetData(getRequestData(listArguments));
} else {
box = dhtmlx.modalbox({
text: "Loading, Please Wait...",
width: "300px"
});
var listArguments = new Array();
listArguments[0] = queryString;
GetData(getRequestData(listArguments));
}
}
else {
//debugger;
var code = employeinfo.getItemValue("txtEmpID");
if (code != "") {
var listArguments = new Array();
listArguments[0] = 'Edit@' + code;
GetData(getRequestData(listArguments));
}
}
}
function GetData(methodArguments) {
success = 0, fail = 0;
$.ajax({
type: “POST”,
async: false,
url: “Detail.aspx” + “/” + “GetEmployee”,
data: methodArguments,
contentType: “application/json; charset=utf-8”,
dataType: “json”,
success: getDataSuccess
});
}
function getDataSuccess(result) {
//debugger;
var jsonObj = result.d[0];
if (jsonObj != undefined) {
if (jsonObj.EmployeeID != null && jsonObj.EmployeeID != “”)
employeinfo.disableItem(“txtEmpID”);
employeinfo.setItemValue("txtEmpID", jsonObj.EmployeeID); // sets the value of item
employeinfo.setItemValue("txtEmpName", jsonObj.EmployeeName); // sets the value of item
cboCategory.attachEvent("onXLE", function (value, text) {
cboCategory.setComboValue(jsonObj.CategoryCode);
});
cboNationality.attachEvent("onXLE", function (value, text) {
cboNationality.setComboValue(jsonObj.NationalityCode);
});
cboDesign.attachEvent("onXLE", function (value, text) {
cboDesign.setComboValue(jsonObj.DesignationCode);
});
cboOTGroup.attachEvent("onXLE", function (value, text) {
cboOTGroup.setComboValue(jsonObj.GroupCode);
});
cboAutoDayChange.attachEvent("onXLE", function (value, text) {
cboAutoDayChange.setComboValue(jsonObj.AutoDayChangeCode);
});
dhtmlx.modalbox.hide(box);
}
}