1

How is the MVC 3 using Razor view engine supposed to pass W3C xhtml validation?

TOP of page:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> .......

My FORM....

@using(Ajax.BeginForm("CreateAccount","Home",null, new AjaxOptions { HttpMethod="POST", OnBegin="CreateOnBegin", OnSuccess="CreateOnSuccess"})){ .......

W3C validations errors: there is no attribute "data-ajax"

on="/en/Home/CreateAccount" data-ajax="true" data-ajax-begin="CreateOnBegin" d…

* there is no attribute "data-ajax-begin" ** there is no attribute "data-ajax-method" * there is no attribute "data-ajax-success" there is no attribute "data-val"

<input data-val="true" data-val-required="The First Name? field…
tereško
  • 58,060
  • 25
  • 98
  • 150
Bryant
  • 11
  • 2

2 Answers2

1

I think you should be validating against HTML5, not XHTML. That's the MS strategy for MVC going forward. I'd simply use:

<!DOCTYPE html>
tvanfosson
  • 524,688
  • 99
  • 697
  • 795
  • ok thank you...saw that ' ' in the default sample project but didn't understand the difference between XHtml and HTML5 I guess...thanks again – Bryant Mar 20 '11 at 01:49
0

As tvanfosson stated above, use HTML 5, which is much more lenient than XHTML, but has well-defined parsing rules, unlike HTML 4.01 and before.

See also this question: HTML 5 versus XHTML 1.0 Transitional?

Community
  • 1
  • 1
Kevin Ji
  • 10,479
  • 4
  • 40
  • 63