javascript form validation final result needed
<p>Hi wrote a javascript validation for my contact page. for that, i used switch case function. that's work fine. But i unable to get the final result as True or false. that means in case all forms are valid then the result should be true else that false. how can i get the result from my function.</p>

<p>this is my function what i wrote ( i like to use this core javascript) :</p>

<pre><code>window.onload = function (){
    var subButton = document.getElementById("submit");
    subButton.onclick = function (){
        var myForm = document.getElementsByTagName('form')[0];
        var myFormStatus = false;
        myElements = myForm.elements;
            for(i=0;i&lt;myElements.length;i++){
                ele = myElements[i];
                if(ele.type == 'text' || ele.type == 'textarea'){
                    switch(ele.id){
                        case 'name':
                        case 'company':
                        case 'message':
                        var valueCheck = textValidation(ele.value);
                        if(valueCheck){
                            var errorSpan = spanMaker(ele.nextSibling);
                            myFormStatus = false;
                        }
                        else{
                                var hideSpan = spanHider (ele.nextSibling);
                                myFormStatus = true;
                        }
                        break;
                        case 'email': 
                            var emailCheck = emailValidation(ele.value);
                            if(!emailCheck){
                                var errorSpan = spanMaker (ele.nextSibling);
                                myFormStatus = false;
                            }
                            else{
                                var hideSpan = spanHider (ele.nextSibling);
                                myFormStatus = true;
                            }
                        break;
                        case 'phone': 
                        var phoneNum = regIsNumber(ele.value);
                        if(!phoneNum){
                            var errorSpan =spanMaker (ele.nextSibling);
                            myFormStatus = false;
                        }
                        else{
                                var hideSpan = spanHider (ele.nextSibling);
                                myFormStatus = true;
                            }
                        break;
                        default :
                        break;
                    }



                }

                function textValidation (text){
                    return !/[^\s]/.test(text); 
                }

                function emailValidation (email){
                    var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
                    return String(email).search (reg) != -1;
                }

                function regIsNumber(fData){
                     var isInteger_re     = /^[\d|\+|\(]+[\)|\d|\s|-]*[\d]$/;
                     return String(fData).search (isInteger_re) != -1;
                }

                function spanMaker(element){
                    while(element &amp;&amp; element.nodeType !=1){
                        element = element.nextSibling;
                        element.style.display = 'block';

                    }   
                }

                function spanHider (element){
                    while(element &amp;&amp; element.nodeType !=1){
                        element = element.nextSibling;
                        element.style.display = 'none';

                    }   
                }

            }
        }
    }   
</code></pre>

<p>any good suggestions?</p>
