HTML5验证和ASP.net Webforms [英] HTML5 validation and ASP.net Webforms

查看:49
本文介绍了HTML5验证和ASP.net Webforms的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在试验HTML5内置的验证属性,遇到的第一个困难是验证属性可以在表单上下文中使用. IE.如果要验证两个独立的输入,则应将它们放在两个不同的<form>标记内.

I'm experimenting with HTML5 built-in validation attributes and the first difficulty I have run into is that the validation attributes work in a form context. I.E. if you want to validate two independent inputs then you should put those inside two different <form> tags.

如何使用asp.net处理这种情况,其中页面是由包含整个内容的大表单组成的?

How to handle this situation with asp.net where the page is formed by a big form containing the whole content?

推荐答案

我认为您有误会.

HTML 5同时具有forminput验证属性. form属性仅允许您打开/关闭自动完成功能,并完全关闭对所有input元素的验证.

HTML 5 has both form and input validation attributes. The form attributes simply allow you to turn on/off autocomplete and completely turn off validation of all of the input elements.

input元素是执行实际工作的位置.请注意,您可以在form级别上打开自动完成功能,但是对于特定的inputs可以将其关闭.

The input elements are where the real work is performed. Note that you can have autocomplete turned on at the form level, but have it turned off for particular inputs.

顺便说一句,嵌套了<form>标签的HTML5仍然是一个不能拒绝的事情.只是各种浏览器都支持它,以便继续与编码错误的绝大多数网站兼容.实际上,这种尽可能兼容的概念是浏览器如此复杂的主要原因.

BTW, having nested <form> tags is still a no no under HTML5. It's just that various browsers support it in order to continue to be compatible with the vast majority of sites that were coded incorrectly. Actually, this concept, of being as compatible as possible, is the leading reason browsers are so complicated.

更多信息: http://www.w3schools.com/html5/html5_form_attributes.asp

这篇关于HTML5验证和ASP.net Webforms的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆