十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
PL.style.display = "none";
PLV.style.display = "none";
// Create a DIV container
var addDiv = document.createElement("div");
addDiv.setAttribute("style", "overflow-y:auto; height:40px;border: 1px #00000 solid;background-color: #ffffff;");
PL.parentNode.appendChild(addDiv);
// Initialise checkbox controls
for (var i = 1; i < PL.options.length; i++) {
var pOption = PL.options[i];
var addInput = document.createElement("input");
addInput.setAttribute("type", "checkbox");
addInput.setAttribute("name", "test");
addInput.setAttribute("onclick", "getRelationDateValue()");
addInput.setAttribute("style", "border:none; width:25px; align:left;");
if (IsRelationDateChecked(pOption.text, PLV)) {
addInput.setAttribute("checked", "checked");
}
var addLabel = document.createElement("labal");
addLabel.innerText = pOption.text;
PL.nextSibling.appendChild(addInput);
PL.nextSibling.appendChild(addLabel);
}
}
// Check if it is selected
function IsRelationDateChecked(pText, PLV) {
if (PLV.value != "") {
var PLVT = PLV.value.split(";");
for (var i = 0; i < PLVT.length; i++) {
if (PLVT[i] == pText)
return true;
}
}
return false;
}
function getRelationDateValue() {
var PL = crmForm.all.new_allowrelationdate;
var pick = crmForm.all.new_checkallowrelation;
var value = "";
var getInput = PL.nextSibling.getElementsByTagName("input");
for (var i = 0; i < getInput.length; i++) {
if (getInput[i].checked) {
value += getInput[i].nextSibling.innerText + ";";
}
}
Xrm.Page.getAttribute("new_checkallowrelation").setValue(value);
}