OK so I am doing a basic form validation script of my course with the little knowledge I have in JavaScript I am not looking for a much more complicated yet shorter way of performing my validation via using loops or something like that, I am awaiting a java book to arrived and will learn more later for now I am just doing a basic validation script.
I just want to know why when I try to display an error message for textarea suddenly the form starts resetting completely.
form 1 works
http://www.richie.id.au/TAFE/form/enquiry.html
form 2 does not work
http://www.richie.id.au/TAFE/form2/enquiry.html
the only difference between the two is this piece of code that causes error messages to disappear:
//Message message action if true of false
if(messageMessage==true){
document.getElementByID('messageError').innerHTML='*Please enter a message*';
}
if(messageMessage==false){
document.getElementByID('messageError').innerHTML='';
}
It’s identical to my other messages so I’m not sure why it causes the form error messages to display for only a second then disappear.
Any help is much appreciated.
document.getElementByID should be: