November 16, 2011

Validation for required field

function WebForm_OnSubmit()
 {

if (typeof (ValidatorOnSubmit) == "function" && ValidatorOnSubmit() == false) {

var txt = document.getElementById("<%= txtClinicianName.ClientID%>").value;

if (txt == "") {

document.getElementById("<%= txtClinicianName.ClientID%>").className = "error";

document.getElementById("<%= txtClinicianName.ClientID%>").focus();

}

else {

document.getElementById("<%= txtClinicianName.ClientID%>").className = "special_text_blue_white";

}

}

else {

return true;

}

}

No comments:

Post a Comment