Hi
I use the following form validation and it works all fine, except my email input does not get validated.

Input type = email
field name = emailto

this is the code:
PHP Code:
function formCheck(formobj){
    
// Enter name of mandatory fields
    
var fieldRequired = Array("emailto","from""emailfrom","zigi");
    
// Enter field description to appear in the dialog box
    
var fieldDescription = Array("Friends E-mail","Friends Name""Your E-mail","Your Name");
    
// dialog message
    
var alertMsg "These fields cannot be left blank:\n";

    var 
l_Msg alertMsg.length;

    for (var 
0fieldRequired.lengthi++){
        var 
obj formobj.elements[fieldRequired[i]];
        if (
obj){
            switch(
obj.type){
            case 
"select-one":
                if (
obj.selectedIndex == -|| obj.options[obj.selectedIndex].text == ""){
                    
alertMsg += " - " fieldDescription[i] + "\n";
                }
                break;
            case 
"select-multiple":
                if (
obj.selectedIndex == -1){
                    
alertMsg += " - " fieldDescription[i] + "\n";
                }
                break;
            case 
"text":
            case 
"textarea":
                if (
obj.value == "" || obj.value == null){
                    
alertMsg += " - " fieldDescription[i] + "\n";
                }
                break;
            case 
"email":
                if (
obj.value == "" || obj.value == null){
                    
alertMsg += " - " fieldDescription[i] + "\n";
                }
                var 
strValue emailto.obj.value
                var 
strFilter = /^([0-9a-z]([-.\w]*[0-9a-z])*@(([0-9a-z])+([-\w]*[0-9a-z])*\.)+[a-z]{2,6})$/i;
                if (!
strFilter.test(strValue))
                    
alertMsg "wrong or incomplete email" fieldDescription[i] + "\n";
                }
                break;
            default:
            }
            if (
obj.type == undefined){
                var 
blnchecked false;
                for (var 
0obj.lengthj++){
                    if (
obj[j].checked){
                        
blnchecked true;
                    }
                }
                if (!
blnchecked){
                    
alertMsg += " - " fieldDescription[i] + "\n";
                }
            }
        }
   }
    if (
alertMsg.length == l_Msg){
        return 
true;
    }else{
        
alert(alertMsg);
        return 
false;
    }

What am I missing in the email validation, please?

and ... are there some samples available for other validations of this kind of form validation, e.g. only digits, no white spaces, etc...

Thank a 8M times