javascript how to stop a submission when errors code example Example: javascript prevent form submit <form name="foo" onsubmit="return false">