I have some form validation done, but it’s not very good. How do i make sure that users can only use a-z, A-Z, 0-9. (there for users would not be able to use special characters) – note: i have the php server side validation done but i want javascript also, thanks
Here is the code i have so far:
[code=html]function validate_username(field,alerttxt)
{
with (field)
{
numofchar=value.length;
if (numofchar<5)
{alert(alerttxt);return false}
else {return true}
}
}
[code=html]function validate_form(thisform)
{
with (thisform)
{
if (validate_username(username,”Ooops… Username must be at least 5 characters in length”)==false)
{username.focus();return false}
how can i make sure that the $username only can have a-z, A-Z, 0-9