function ValidatetxtPhone(sender, args)
{
document.getElementById('<%# CustomPhoneNumber.ClientID %>').innerHTML = "";
var txt1 = document.getElementById('<%# txtPhone1.ClientID %>').value;
var txt2 = document.getElementById('<%# txtPhone2.ClientID %>').value;
var txt3 = document.getElementById('<%# txtPhone3.ClientID %>').value;
if ((txt1 == "000") && (txt2 == "000") && (txt3 == "0000")) {
document.getElementById('<%# CustomPhoneNumber.ClientID %>').innerHTML = "Please enter valid phone number";
return args.IsValid = false;
}
else if ((txt1 != "") && (txt1 == 3)) {
if ((txt2 != "") && (txt2 == 3)) {
if ((txt3 != "") && (txt3 == 4)) {
return args.IsValid = true;
}
}
}
else if ((txt1 == "") && (txt2 == "") && (txt3 == "")) {
document.getElementById('<%# CustomPhoneNumber.ClientID %>').innerHTML = "Please enter phone number(### ### ####)";
return args.IsValid = false;
}
else if ((txt1.length < 3) || (txt2.length < 3) || (txt3.length < 4)) {
document.getElementById('<%# CustomPhoneNumber.ClientID %>').innerHTML = "Please enter valid phone number";
return args.IsValid = false;
}
else {
return args.IsValid = true;
}
}
{
document.getElementById('<%# CustomPhoneNumber.ClientID %>').innerHTML = "";
var txt1 = document.getElementById('<%# txtPhone1.ClientID %>').value;
var txt2 = document.getElementById('<%# txtPhone2.ClientID %>').value;
var txt3 = document.getElementById('<%# txtPhone3.ClientID %>').value;
if ((txt1 == "000") && (txt2 == "000") && (txt3 == "0000")) {
document.getElementById('<%# CustomPhoneNumber.ClientID %>').innerHTML = "Please enter valid phone number";
return args.IsValid = false;
}
else if ((txt1 != "") && (txt1 == 3)) {
if ((txt2 != "") && (txt2 == 3)) {
if ((txt3 != "") && (txt3 == 4)) {
return args.IsValid = true;
}
}
}
else if ((txt1 == "") && (txt2 == "") && (txt3 == "")) {
document.getElementById('<%# CustomPhoneNumber.ClientID %>').innerHTML = "Please enter phone number(### ### ####)";
return args.IsValid = false;
}
else if ((txt1.length < 3) || (txt2.length < 3) || (txt3.length < 4)) {
document.getElementById('<%# CustomPhoneNumber.ClientID %>').innerHTML = "Please enter valid phone number";
return args.IsValid = false;
}
else {
return args.IsValid = true;
}
}
No comments:
Post a Comment