Hi,
I have some problems with validating form in javascript.
I have a following HTML code:
<form action="registracija_preview.php" method="post" onsubmit="return ValidirajFormu();">
</form>
<div id='poruka></div>
What I want in validation is to check all the field in form (check for required fields etc). I want to show user error message in div tag with id='poruka'.
Part of code of function ValidirajFormu:
function ValidirajFormu(){
var ime=(String) document.getElementById('ime');
if(ime){
document.getElementById('poruka').innerHTML='Niste unijeli ime!';
return false;
}
....//other validations
else{
return true;
}
}
So, validation works OK, but message is not written in div tag.
Only if all fields are correct, form is submited, but there are no error message.
I appriciate any kind of help.
Thanks in advance,
Amer