What's wrong with this code?:
It's just supposed to validate the form and make sure all the fields are filled.Code:<script> function check(f) { if (f.title.value == "") { alert("You must have a subject."); } elseif (f.body.value == "") { alert("You must have a body in your post."); } elseif (f.body.value.length > 10000) { alert("Your message is too long. The max is 10000 characters."); } else { document.f.submit(); } } </script> <form action="post.php" method="post"> ... <input type="button" value=" Submit " onClick="check(forms(0))">




Reply With Quote