服务器端表单标记的W3C验证

时间:2022-01-06 15:46:46

I've checked my website html validation in w3.org and got this error

我在w3.org上检查了我的网站html验证并得到了这个错误

Bad value for attribute action on element form: Must be non-empty.

元素表单上属性操作的值不正确:必须为非空。

but my form is asp.net server-side form and I can't set action atribute.

但我的表单是asp.net服务器端表单,我无法设置操作属性。

How can I solve this error?

我该如何解决这个错误?

3 个解决方案

#1


11  

This is an old post, but for future reference in ASP.NET one can do the following to avoid blank action attributes:

这是一篇旧帖子,但是为了将来在ASP.NET中引用,可以执行以下操作以避免空白操作属性:

<form action="#" runat="server">

This will validate with W3C and does not require you to do any special coding to detect the page url you are currently on.

这将通过W3C验证,并且不要求您执行任何特殊编码来检测您当前所在的页面网址。

#2


7  

form1.Action = Request.Url.AbsoluteUri;

this is working for me

这对我有用

#3


2  

Omit the attribute action. According to HTML5 drafts, it is not required, but if present, its value must be non-empty. Reference: WHATWG HTML5 draft, description of action attribute.

省略属性动作。根据HTML5草案,它不是必需的,但如果存在,其值必须是非空的。参考:WHATWG HTML5草案,动作属性的描述。

#1


11  

This is an old post, but for future reference in ASP.NET one can do the following to avoid blank action attributes:

这是一篇旧帖子,但是为了将来在ASP.NET中引用,可以执行以下操作以避免空白操作属性:

<form action="#" runat="server">

This will validate with W3C and does not require you to do any special coding to detect the page url you are currently on.

这将通过W3C验证,并且不要求您执行任何特殊编码来检测您当前所在的页面网址。

#2


7  

form1.Action = Request.Url.AbsoluteUri;

this is working for me

这对我有用

#3


2  

Omit the attribute action. According to HTML5 drafts, it is not required, but if present, its value must be non-empty. Reference: WHATWG HTML5 draft, description of action attribute.

省略属性动作。根据HTML5草案,它不是必需的,但如果存在,其值必须是非空的。参考:WHATWG HTML5草案,动作属性的描述。