function validate(form){ var nome = form.name.value; var company = form.company.value; var email = form.email.value; var flagValid = false; if(isEmpty(nome)){ alert("Il campo \'Name\' e\' obbligatorio"); }else if ( isEmpty(company)){ alert("Il campo \'Company\' e\' obbligatorio"); }else if(isEmpty(email)){ alert("Il campo \'Email\' e\' obbligatorio"); } else if(!validateEmail(email)){ alert("Il campo \'Email\' e\' errato"); } else { flagValid = true; } return flagValid; } function isEmpty(value){ var empty = (typeof value == 'undefined') || (value == null); if(!empty){ var objRegExp = /^(\s*)$/; empty = (objRegExp.test(value)); } return empty } function validateEmail( strValue) { return (strValue.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) != -1); } function validateEntryForm(form){ var article_name = form.article_name.value; var error_desc = form.error_desc.value; var flagValid = false; if(isEmpty(article_name)){ alert("Il campo \'Item Name\' e\' obbligatorio"); } else if(isEmpty(error_desc)){ alert("Il campo \'Error Description\' e\' obbligatorio"); } else{ flagValid = true; } return flagValid; }