<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
//called when key is pressed in textbox
$("[id*=grid][id*=txtrefno]").keypress(function (e) {
//if the letter is not digit then display error and don't type anything
if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) {
return false;
}
});
$(function () {
$("[id*=chksave]").change(function () {
var row = $(this).closest("tr");
var checkbox = row.find("[id*=chksave]");
var ddlbank = row.find("[id*=ddlBank]");
var ddlbranchdebit = row.find("[id*=ddlBranchdebit]");
var ddlpaymod = row.find("[id*=ddlPaymod]");
var ddlticket = row.find("[id*=ddlticket]");
//find the label control
var txtref = row.find("[id*=txtRef]");
var txtrefva = txtref.val();
//Find the TextBox control.
var txtrefno = row.find("[id*=txtrefno]");
var txtrefdat = row.find("[id*=txtRefDat]");
var txtnar = row.find("[id*=txtnar]");
var txtrem = row.find("[id*=txtrem]");
if (txtrefva == "") {
alert("Enter Ref#");
checkbox.attr('checked', false);
return false;
}
//Validate the DropDownList control.
if (ddlbank.val() == "0") {
alert("Please Select Debit Bank.");
checkbox.attr('checked', false);
return false;
}
if (ddlbranchdebit.val() == "0") {
alert("Please Select Debit Branch.");
checkbox.attr('checked', false);
return false;
}
if (ddlpaymod.val() == "0") {
alert("Please Select Payment Mode.");
checkbox.attr('checked', false);
return false;
}
//Validate the TextBox control.
if (ddlpaymod.val() == "C" && txtrefno.val() == "") {
alert("Please Enter Payment Cheque Number.");
checkbox.attr('checked', false);
return false;
}
var len = txtrefno.val().length;
if (ddlpaymod.val() == "C" && len != 6) {
alert("Please Enter 6 digit Cheque Number.");
checkbox.attr('checked', false);
return false;
}
// $("#quantity").keypress(function (e) {
// //if the letter is not digit then display error and don't type anything
// if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) {
// //display error message
// $("#errmsg").html("Digits Only").show().fadeOut("slow");
// return false;
// }
// });
if (txtrefdat.val() == "") {
alert("Please Enter Payment Ref. Date.");
checkbox.attr('checked', false);
return false;
}
// if (txtnar.val() == "") {
// alert("Please Enter Narration.");
// return false;
// }
if (ddlticket.val() == "0") {
alert("Please Select Status");
checkbox.attr('checked', false);
return false;
}
if (ddlticket.val() == "PR" && txtrem.val() == "") {
alert("Please Enter Remarks.");
checkbox.attr('checked', false);
return false;
}
// checkbox.attr('checked', true);
return true;
});
});
});
</script>
<script type="text/javascript">
$(document).ready(function () {
//called when key is pressed in textbox
$("[id*=grid][id*=txtrefno]").keypress(function (e) {
//if the letter is not digit then display error and don't type anything
if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) {
return false;
}
});
$(function () {
$("[id*=chksave]").change(function () {
var row = $(this).closest("tr");
var checkbox = row.find("[id*=chksave]");
var ddlbank = row.find("[id*=ddlBank]");
var ddlbranchdebit = row.find("[id*=ddlBranchdebit]");
var ddlpaymod = row.find("[id*=ddlPaymod]");
var ddlticket = row.find("[id*=ddlticket]");
//find the label control
var txtref = row.find("[id*=txtRef]");
var txtrefva = txtref.val();
//Find the TextBox control.
var txtrefno = row.find("[id*=txtrefno]");
var txtrefdat = row.find("[id*=txtRefDat]");
var txtnar = row.find("[id*=txtnar]");
var txtrem = row.find("[id*=txtrem]");
if (txtrefva == "") {
alert("Enter Ref#");
checkbox.attr('checked', false);
return false;
}
//Validate the DropDownList control.
if (ddlbank.val() == "0") {
alert("Please Select Debit Bank.");
checkbox.attr('checked', false);
return false;
}
if (ddlbranchdebit.val() == "0") {
alert("Please Select Debit Branch.");
checkbox.attr('checked', false);
return false;
}
if (ddlpaymod.val() == "0") {
alert("Please Select Payment Mode.");
checkbox.attr('checked', false);
return false;
}
//Validate the TextBox control.
if (ddlpaymod.val() == "C" && txtrefno.val() == "") {
alert("Please Enter Payment Cheque Number.");
checkbox.attr('checked', false);
return false;
}
var len = txtrefno.val().length;
if (ddlpaymod.val() == "C" && len != 6) {
alert("Please Enter 6 digit Cheque Number.");
checkbox.attr('checked', false);
return false;
}
// $("#quantity").keypress(function (e) {
// //if the letter is not digit then display error and don't type anything
// if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) {
// //display error message
// $("#errmsg").html("Digits Only").show().fadeOut("slow");
// return false;
// }
// });
if (txtrefdat.val() == "") {
alert("Please Enter Payment Ref. Date.");
checkbox.attr('checked', false);
return false;
}
// if (txtnar.val() == "") {
// alert("Please Enter Narration.");
// return false;
// }
if (ddlticket.val() == "0") {
alert("Please Select Status");
checkbox.attr('checked', false);
return false;
}
if (ddlticket.val() == "PR" && txtrem.val() == "") {
alert("Please Enter Remarks.");
checkbox.attr('checked', false);
return false;
}
// checkbox.attr('checked', true);
return true;
});
});
});
</script>
Post a Comment (0)