var mId; function ContentPlaceHolderName(idVal) { mId = idVal; } function ValidRequiredField(RequiredField) { var Isvalid = true; var OtherPersonFld = new Array; var fld = RequiredField.split(','); for (n = 0; n < fld.length; n++) { OtherPersonFld[n] = mId + fld[n]; } for (i = 0; i < OtherPersonFld.length; i++) { $('#' + OtherPersonFld[i]).css('background-color', '#FFFFFF'); var a = $('#' + OtherPersonFld[i]).val(); if (a === "" || a === null || a === "0") { $('#' + OtherPersonFld[i]).css('background-color', '#FFCCD2'); Isvalid = false; } } if (Isvalid === false) { //ShowAlertMessage('Required Field(s)\n _____________________________ \n The red fields are required!', 'info'); swal('Required Field(s)\n _____________________________ \n The red fields are required!'); //alert('Required Field(s)\n _____________________________ \n The red fields are required!', 'info'); } return Isvalid; } function ValidRequiredFieldWithDoc(RequiredField) { var Isvalid = true; var OtherPersonFld = new Array; var fld = RequiredField.split(','); for (n = 0; n < fld.length; n++) { OtherPersonFld[n] = mId + fld[n]; } for (i = 0; i < OtherPersonFld.length; i++) { if (OtherPersonFld[i] == 'MainContent_reg_front_id') { $('#front').css('background-color', '#FFFFFF'); var a = $('#' + OtherPersonFld[i]).val(); if (a === "" || a === null || a === "0") { $('#front').css('background-color', '#FFCCD2'); Isvalid = false; } } else if (OtherPersonFld[i] == 'MainContent_reg_back_id') { $('#back').css('background-color', '#FFFFFF'); var b = $('#' + OtherPersonFld[i]).val(); if (b === "" || b === null || b === "0") { $('#back').css('background-color', '#FFCCD2'); Isvalid = false; } } else { $('#' + OtherPersonFld[i]).css('background-color', '#FFFFFF'); var c = $('#' + OtherPersonFld[i]).val(); if (c === "" || c === null || c === "0") { $('#' + OtherPersonFld[i]).css('background-color', '#FFCCD2'); Isvalid = false; } } } if (Isvalid === false) { //ShowAlertMessage('Required Field(s)\n _____________________________ \n The red fields are required!', 'info'); swal('Required Field(s)\n _____________________________ \n The red fields are required!'); //alert('Required Field(s)\n _____________________________ \n The red fields are required!', 'info'); } return Isvalid; } function ParseDDlDynamic(response, DDL, textField, idField, defaultText) { var data = response; var myDDL = GetElement(mId + DDL); $(myDDL).empty(); var option; if (defaultText !== "" && defaultText !== undefined) { option = document.createElement("option"); option.text = defaultText; option.value = ""; myDDL.options.add(option); } for (var i = 0; i < data.length; i++) { option = document.createElement("option"); option.text = data[i][textField].toUpperCase(); option.value = data[i][idField]; try { myDDL.options.add(option); } catch (e) { alert(e); } } } function AlertMsg(result) { if (result.ResponseCode === "0") { swal(result.Msg, "", "success"); } swal(result.Msg, "", "error"); } function SetValueById(id, value, innerHTML) { SetValueByObj(GetElement(id), value, innerHTML); } function SetValueByObj(obj, value, innerHTML) { if (innerHTML) { obj.innerHTML = innerHTML; } else { obj.value = value; } } function GetElement(id) { return document.getElementById(id); } function GetValue(id) { var obj = document.getElementById(id); if (obj == null || obj == undefined) return ""; return obj.value; } function ValidRequiredFieldNew(RequiredField) { var Isvalid = true; var OtherPersonFld = new Array; var fld = RequiredField.split(','); for (n = 0; n < fld.length - 1; n++) { OtherPersonFld[n] = fld[n]; } for (i = 0; i < OtherPersonFld.length; i++) { GetElement(OtherPersonFld[i]).style.background = "#FFFFFF"; var a = GetElement(OtherPersonFld[i]).value; if (GetElement(OtherPersonFld[i]).value == "") { GetElement(OtherPersonFld[i]).style.background = "#FFCCD2"; Isvalid = false; } } if (Isvalid == false) { alert("Required Field(s)\n _____________________________ \n The red fields are required!") } return Isvalid; }