<html> <head> </style> </head> <body> <form id="f"> <input id="i"> <input type="submit"> </form> <script> f.onsubmit=function(){ if(i.value!=="foo") return false } </script> </body> </html>