javascript prevent form from submitting on error code example Example: javascript prevent form submit <form name="foo" onsubmit="return false">