I\'m making a comment feature for my website and need to make it so that after the person submits a comment (and it contains errors), it will show the error without refreshi
I think it is easier to do the validation at the client side via Javascript. Instead of simply using a button of type submit, write a function and bind it to the button's onclick() event.
Something like this:
function submit() {
if (document.getElementById("myTextarea").value=='') {
alert("Your comment is too short.");
}
else {
document.getElementById("myForm").submit();
}
}