javascript - JQuery and Serverside requiredfield validations can check both on click event -
can check both server side , custom jquery validations on click event ??
i have function in js returns true or false after validation .. call on onclientclick event when returns true postback skipping require field validators validations ... how handle other lot of code in js validations move in js , remove serverside tags ?
thats code
$(".number-allowed").focusout(function () { var sum = 0; var stockvalue = $('#tblquantity tr:eq(' + ($(".number-allowed").index(this) + 1) + ') td:eq(' + 1 + ')').text(); var lblstatus = $('#tblquantity tr:eq(' + ($(".number-allowed").index(this) + 1) + ') td:eq(' + 3 + ')'); var inputvalue = $(this).val(); var totalquantity = $('#txtquantity').val(); $('.number-allowed').each(function () { sum += number($(this).val()); }); if (parseint(inputvalue) > parseint(stockvalue)) { $(this).focus(); $(this).css("border-color", "red"); lblstatus.text("value greater stock"); return; } else { $(this).removeattr("style"); lblstatus.text(""); } if (parseint(inputvalue) > parseint(totalquantity)) { $(this).focus(); $(this).css("border-color", "red"); lblstatus.text("value greater quantity"); return; } else { $(this).removeattr("style"); lblstatus.text(""); } if (parseint(sum) > parseint(totalquantity)) { $(this).focus(); $(this).css("border-color", "red"); lblstatus.text("total value exceeds quantity"); return; } else { $(this).removeattr("style"); lblstatus.text(""); } });
Comments
Post a Comment