开发者

MVC 3 valid XHTML for Ajax.BeginForm fails?

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" * the开发者_开发知识库re is no attribute "data-ajax-success" there is no attribute "data-val"

<input data-val="true" data-val-required="The First Name? field…


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>


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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜