//First get the counting of textbox
flag = false;
cnt =0
$(".dyntxt").each(function () {
if ($(this).val() == "") {
flag = true;
$(this).focus();
return false;
}
cnt =cnt +1
});
//To Check Textbox is fiiled or not
if (flag) {
alert("Please fill student name")
return false;
}
else if (!flag) {
count = Number(cnt - 1);
//count = Number((document.frmDefineSSS.cboTeamSize.selectedIndex) - 1);
flagSame = false;
//to check the duplicate value
for (i = 1; i <= count; i++) {
for (j = i + 1; j <= count + 1; j++) {
if ($("#txtStudName" + [i]).val() == $("#txtStudName" + [j]).val()) {
alert("Team Member can't be same.");
$("#txtStudName" + [i]).css("background-color", "yellow");
$("#txtStudName" + [j]).css("background-color", "yellow");
flagSame = false;
return false;
}
else {
$("#txtStudName" + [i]).css("background-color", "white");
$("#txtStudName" + [j]).css("background-color", "white");
flagSame = true;
}
}
}
}
if(flagSame) {
document.frm.action = ""
document.frm.submit()
return true
}
flag = false;
cnt =0
$(".dyntxt").each(function () {
if ($(this).val() == "") {
flag = true;
$(this).focus();
return false;
}
cnt =cnt +1
});
//To Check Textbox is fiiled or not
if (flag) {
alert("Please fill student name")
return false;
}
else if (!flag) {
count = Number(cnt - 1);
//count = Number((document.frmDefineSSS.cboTeamSize.selectedIndex) - 1);
flagSame = false;
//to check the duplicate value
for (i = 1; i <= count; i++) {
for (j = i + 1; j <= count + 1; j++) {
if ($("#txtStudName" + [i]).val() == $("#txtStudName" + [j]).val()) {
alert("Team Member can't be same.");
$("#txtStudName" + [i]).css("background-color", "yellow");
$("#txtStudName" + [j]).css("background-color", "yellow");
flagSame = false;
return false;
}
else {
$("#txtStudName" + [i]).css("background-color", "white");
$("#txtStudName" + [j]).css("background-color", "white");
flagSame = true;
}
}
}
}
if(flagSame) {
document.frm.action = ""
document.frm.submit()
return true
}
No comments:
Post a Comment