javascript validation for both non empty and number, alphabets
i have a form that accepts name, phone no. . Now i have done validation
for non empty fields, i want validation for name(alphabets) and phone
no.(numbers). here's my code.
On submitting the form i will be calling validateform() function:
function validateform()
{
var str= true;
document.getElementById("name").innerHTML="";
if(document.frm.name.value=="")
{
document.getElementById("name").innerHTML="Please enter Name";
str=false;
}
return str;
}
now the enter value for name should be only alphabets. I want to include
the message "enter only alphabets" if its not. how do i do it
No comments:
Post a Comment