如果我点击“添加平板”字段将会出现,我将输入错误的值,它应该显示验证,是的,它正确到来。 如果我再次单击“添加slab”并输入错误的值,则表明第二次没有显示验证。迭代没有发生,请帮助我。
function validatecommissionpercent() {
var commReg = "^[0-9]*\.?[0-9]+$";
var status = true;
var commissionpercentval = jQuery('#commissionpercentId').val();
var commissionminamountval = jQuery('#commissionamountId').val();
if (jQuery("#commissionpercentId").val().match(commReg)) {
jQuery("#commissionpercentErrMsg").hide();
} else {
jQuery("#commissionpercentErrMsg").text("Invalid entry ");
jQuery("#commissionpercentErrMsg").show();
status = false;
}
if (jQuery("#commissionamountId").val().match(commReg)) {
jQuery("#commissionminamountErrMsg").hide();
} else {
jQuery("#commissionminamountErrMsg").text("Invalid entry ");
jQuery("#commissionminamountErrMsg").show();
status = false;
}
if (commissionpercentval < 0) {
jQuery("#commissionpercentErrMsg").text("-ve values are not allowed ");
jQuery('#commissionpercentErrMsg').show();
status = false;
} else if (status == true) {
jQuery('#commissionpercentErrMsg').hide();
}
if (commissionminamountval < 0) {
jQuery("#commissionminamountErrMsg").text("-ve values are not allowed ");
jQuery('#commissionminamountErrMsg').show();
status = false;
} else if (status == true) {
jQuery('#commissionminamountErrMsg').hide();
}
var commissionpercent1 = jQuery('#commissionpercentId').val();
var commissionminamount1 = jQuery('#commissionamountId').val();
var commisionDataArray = commissionpercent1.split(".");
var commissionAmountArray = commissionminamount1.split(".");
var prefixNum = commisionDataArray[0];
var suffixNum = commisionDataArray[1];
var prefixAmountNum = commissionAmountArray[0];
var suffixAmountNum = commissionAmountArray[1];
if (prefixNum != null || prefixAmountNum != null) {
if (suffixNum != '' && suffixNum != null && suffixNum.length > 2) {
jQuery('#commissionpercentErrMsg').text("should accept only 2 decimal values");
jQuery('#commissionpercentErrMsg').show();
status = false;
}
if (suffixAmountNum != '' && suffixAmountNum != null && suffixAmountNum.length > 2) {
jQuery('#commissionminamountErrMsg').text("should accept only 2 decimal values");
jQuery('#commissionminamountErrMsg').show();
status = false;
}
} else {
if (suffixNum.length <= 2) {
if (status == true || status == 'true') {
jQuery('#commissionpercentErrMsg').text("");
jQuery('#commissionpercentErrMsg').hide();
}
}
if (suffixAmountNum.length <= 2) {
if (status == true || status == 'true') {
jQuery('#commissionminamountErrMsg').text("");
jQuery('#commissionminamountErrMsg').hide();
}
}
}
return status;
}
function validateslabflag() {
var commReg = "^[0-9]*\.?[0-9]+$";
var status = true;
var startingamountval = jQuery('#saId').val();
var endamounttval = jQuery('#eaId').val();
var fixedamountval = jQuery('#faId').val();
var percentageval = jQuery('#pId').val();
var maximumamountval = jQuery('#maId').val();
if (jQuery("#saId").val().match(commReg)) {
if (status == true) {
jQuery("#saErrMsg").hide();
}
} else {
jQuery("#saErrMsg").text("Invalid entry ");
jQuery("#saErrMsg").show();
status = false;
}
if (jQuery("#eaId").val().match(commReg)) {
if (status == true) {
jQuery("#eaErrMsg").hide();
}
} else {
jQuery("#eaErrMsg").text("Invalid entry ");
jQuery("#eaErrMsg").show();
status = false;
}
if (jQuery("#faId").val().match(commReg)) {
if (status == true) {
jQuery("#faErrMsg").hide();
}
} else {
jQuery("#faErrMsg").text("Invalid entry ");
jQuery("#faErrMsg").show();
status = false;
}
if (jQuery("#pId").val().match(commReg)) {
if (status == true) {
jQuery("#pErrMsg").hide();
}
} else {
jQuery("#pErrMsg").text("Invalid entry ");
jQuery("#pErrMsg").show();
status = false;
}
if (jQuery("#maId").val().match(commReg)) {
if (status == true) {
jQuery("#maErrMsg").hide();
}
} else {
jQuery("#maErrMsg").text("Invalid entry ");
jQuery("#maErrMsg").show();
status = false;
}
if (startingamountval < 0) {
jQuery("#saErrMsg").text("-ve values are not allowed ");
jQuery('#saErrMsg').show();
status = false;
} else if (status == true) {
jQuery('#saErrMsg').hide();
}
if (endamounttval < 0) {
jQuery("#eaErrMsg").text("-ve values are not allowed ");
jQuery('#eaErrMsg').show();
status = false;
} else if (status == true) {
jQuery('#eaErrMsg').hide();
}
if (fixedamountval < 0) {
jQuery("#faErrMsg").text("-ve values are not allowed ");
jQuery('#faErrMsg').show();
status = false;
} else if (status == true) {
jQuery('#faErrMsg').hide();
}
if (percentageval < 0) {
jQuery("#pErrMsg").text("-ve values are not allowed ");
jQuery('#pErrMsg').show();
status = false;
} else if (status == true) {
jQuery('#pErrMsg').hide();
}
if (maximumamountval < 0) {
jQuery("#maErrMsg").text("-ve values are not allowed ");
jQuery('#maErrMsg').show();
status = false;
} else if (status == true) {
jQuery('#maErrMsg').hide();
}
var saval1 = jQuery('#saId').val();
var eaval1 = jQuery('#eaId').val();
var faval1 = jQuery('#faId').val();
var pval1 = jQuery('#pId').val();
var maval1 = jQuery('#maId').val();
saDataArray = saval1.split(".");
eaDataArray = eaval1.split(".");
faDataArray = faval1.split(".");
pDataArray = pval1.split(".");
maDataArray = maval1.split(".");
var pn1 = saDataArray[0];
var sn1 = saDataArray[1];
var pn2 = eaDataArray[0];
var sn2 = eaDataArray[1];
var pn3 = faDataArray[0];
var sn3 = faDataArray[1];
var pn4 = pDataArray[0];
var sn4 = pDataArray[1];
var pn5 = maDataArray[0];
var sn5 = maDataArray[1];
if (pn1 != null || pn2 != null) {
if (sn1 != '' && sn1 != null && sn1.length > 2)
{
jQuery('#saErrMsg').text("should accept only 2 decimal values");
jQuery('#saErrMsg').show();
status = false;
}
if (sn2 != '' && sn2 != null && sn2.length > 2) {
jQuery('#eaErrMsg').text("should accept only 2 decimal values");
jQuery('#eaErrMsg').show();
status = false;
}
} else {
if (sn1.length <= 2) {
if (status == true || status == 'true') {
jQuery('#saErrMsg').text("");
jQuery('#saErrMsg').hide();
}
}
if (sn2.length <= 2) {
if (status == true || status == 'true') {
jQuery('#eaErrMsg').text("");
jQuery('#eaErrMsg').hide();
}
}
}
if (pn3 != null || pn4 != null) {
if (sn3 != '' && sn3 != null && sn3.length > 2)
{
jQuery('#faErrMsg').text("should accept only 2 decimal values");
jQuery('#faErrMsg').show();
status = false;
}
if (sn4 != '' && sn4 != null && sn4.length > 2) {
jQuery('#pErrMsg').text("should accept only 2 decimal values");
jQuery('#pErrMsg').show();
status = false;
}
} else {
if (sn3.length <= 2) {
if (status == true || status == 'true') {
jQuery('#faErrMsg').text("");
jQuery('#faErrMsg').hide();
}
}
if (sn4.length <= 2) {
if (status == true || status == 'true') {
jQuery('#pErrMsg').text("");
jQuery('#pErrMsg').hide();
}
}
}
if (pn5 != null) {
if (sn5 != '' && sn5 != null && sn5.length > 2)
{
jQuery('#maErrMsg').text("should accept only 2 decimal values");
jQuery('#maErrMsg').show();
status = false;
}
} else {
if (sn5.length <= 2) {
if (status == true || status == 'true') {
jQuery('#maErrMsg').text("");
jQuery('#maErrMsg').hide();
}
}
}
return status;
}