hi guys! i am searching my mind for hours and do not understand why this thing doesn't work - it sepose to show erros if the email field in the form is empty buy it doesn't... PLEASE HELP ME!! and here it is: This is one function who call another function: Myfunc(){ if (!validEmailValue){ shows erros BOX/// My_erros.innerHTML= "eMail adress IS INVALID"; return false; } else { form1.submit(); } return true; } function validEmailValue(){ mailPass = form1.my_Email.value; if (mailPass==""){ return false; }
There you go : function Myfunc() { if (!validEmailValue()) { //shows erros BOX My_erros.innerHTML= "eMail adress IS INVALID"; return false; } else { form1.submit(); } return true; } function validEmailValue() { mailPass = form1.my_Email.value; if (mailPass=="") { return false; } return true; } Code (markup): And a better way : function Myfunc() { if (!validEmailValue()) { My_erros.innerHTML= "eMail adress IS INVALID"; return false; } else return true; } function validEmailValue() { mailPass = form1.my_Email.value; return (mailPass != ""); } Code (markup): and ofcourse you need to change the form onsubmit event to return Myfunc(); Like this : <form onsubmit="return Myfunc();"> HTML: Good luck