function ValidateElement(element) {
if ($(element).val() == '') {
$(element).css("border", "1px solid red");
}
$(element).hover(function () {
if ($(element).val() == '') {
qtipPopup(element, "Required Field");
}
},
function () {
if ($(element).data("qtip")) $(element).qtip("destroy");
});
$(element).focusout(function () {
if ($(element).val() != '') {
$(element).css("border", "");
}
else {
$(element).css("border", "1px solid red");
}
});
}
function qtipPopup(element, message) {
$.fn.qtip.zindex = "999";
if ($(element).data("qtip")) $(element).qtip("destroy");
$(element).css("border", "1px solid red");
$(element).qtip({
overwrite: false, content: message,
position: { my: 'bottomLeft', at: 'leftTop' },
show: { event: 'focus' },
hide: { event: 'focusout' },
style: { classes: 'ui-tooltip-green', name: 'dark' }
});
}
function GridTextValidation() {
var gridValid = true;
var loopStart = ($("[id$='grdWorkOrderCharges']").find('tr').length > 9) ? 0 : 1;
for (var i = loopStart; i < $("[id$='grdWorkOrderCharges']").find('tr').length; i++) {
var rowData1 = $("[id$='grdWorkOrderCharges']").find('tr')[i];
var ChargeAccountInfo = $(rowData1).find('input[id$=txtChargeAccount]');
if ($(ChargeAccountInfo) != null) {
if ($(ChargeAccountInfo).val().length > 0) {
if ($(ChargeAccountInfo).data("qtip"))
$(ChargeAccountInfo).qtip("destroy");
}
else {
ValidateElement($(ChargeAccountInfo));
gridValid = false;
}
}
}
return gridValid;
}
No comments:
Post a Comment