Announcements
//eg. addValidator("customerid", "Customer")
function addValidator(fieldName, fieldLabel) {
if (typeof (Page_Validators) == 'undefined') return;
// Create new validator
$("#" + fieldName + "_label").parent().addClass("required");
var newValidator = document.createElement('span');
newValidator.style.display = "none";
newValidator.id = "RequiredFieldValidator" + fieldName;
newValidator.controltovalidate = "";
newValidator.errormessage = "<a href='#" + fieldName + "_label'>" + fieldLabel + " is a mandatory field.</a>";
newValidator.validationGroup = "";
newValidator.initialvalue = "";
newValidator.evaluationfunction = function () {
var value = $("#" + fieldName).val();
if (value == null || value == "") {
return false;
} else {
return true;
}
};
// Add the new validator to the page validators array:
Page_Validators.push(newValidator);
// Wire-up the click event handler of the validation summary link
$("a[href='#" + fieldName + "_label']").on("click", function () { scrollToAndFocus(fieldName + '_label', fieldName); });
}
//eg. removeValidator("customerid")
function removeValidator(fieldName) {
var count = 0;
for(var i =0; i < Page_Validators.length - count; i++){
if (Page_Validators[i - count].id == "RequiredFieldValidator" + fieldName) {
Page_Validators.splice(i - count, 1);
count++;
}
}
$("#" + fieldName + "_label").parent().removeClass("required");
}
$("#NewAttachFileLabel").parent().addClass("required");
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.