W3C home > Mailing lists > Public > www-validator@w3.org > January 2011

[VE][html5] Form onsubmit Error: Invalid Return

From: Paul Spangler <pspangler3@gatech.edu>
Date: Thu, 20 Jan 2011 21:03:57 -0500
Message-ID: <4D38E98D.8060406@gatech.edu>
To: www-validator@w3.org
Hello,

I couldn't find in the HTML 5 spec where it talks about the form 
element's onsubmit event, but previously the typical form validation was 
onsubmit="return validationFunction()". However, this gives a validation 
error:

/Line 8, Column 31/: Bad value return false for attribute onsubmit on 
element form: invalid return

|	<form onsubmit="return false"*>*|

What is the correct way to cancel a form submission in HTML 5? The error 
message is not very clear in this regard considering it's valid in 
previous specs and supported in modern browsers. Full example below:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="ISO-8859-1" />
<title>Form Validation Test</title>
</head>
<body>
<form onsubmit="return false">
<input type="submit" value="Do Not Submit Me!" />
</form>
</body>
</html>

Thank you,
Paul
Received on Saturday, 22 January 2011 07:06:43 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 25 April 2012 12:14:45 GMT