提交空的选择倍数是否有标准的客户行为? [英] Is there a standard client behaviour for submitting an empty select multiple?

查看:150
本文介绍了提交空的选择倍数是否有标准的客户行为?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

http://www.w3.org/TR/html401/interact/forms.html#edef-SELECT

如果提交的选择倍数为空,则不指定客户端的行为.有人知道这是否有标准吗?

Doesn't specify how the client should behave if the submitted select multiple is empty. Does anyone know whether there is a standard for that ?

推荐答案

遗憾的是,我没有时间对此进行测试,但是我希望以下内容能对您有所帮助...

Sadly, I do not have the time to test this, but I hope the following can help you...

如果我没记错的话,则在加载页面时默认选择第一个元素.因此,使用formselect创建一个非常简单的HTML文件,该文件的multiple属性处于活动状态,并且包含几个options.然后,打开文件以查看在几种浏览器(例如Chrome,Firefox,Internet Explorer,Opera和Safari)中会发生什么情况.

If I am not mistaken, the first element is selected by default when the page is loaded. Therefore, create a very simple HTML file with a form and a select that has the multiple attribute active and with a few options. Then, open the file to see what happens in a few browsers such as Chrome, Firefox, Internet Explorer, Opera and Safari.

另一件事是在这里查看HTML5对此的看法: http://dev.w3.org/html5/spec/Overview.html#the-select-element .

Another thing would be to look what HTML5 says about this here: http://dev.w3.org/html5/spec/Overview.html#the-select-element.

更新

W3C HTML 4.01标准对此进行了说明(在您提供的链接中向下滚动):

The W3C HTML 4.01 standard states this (scroll a bit down in the link you provided):

17.6.1预先选择的选项

17.6.1 Pre-selected options

可能为零或更多选择 为用户预先选择.用户代理 应该确定哪些选择是 预选如下:

Zero or more choices may be pre-selected for the user. User agents should determine which choices are pre-selected as follows:

如果没有OPTION元素被选中 属性集,用户代理的行为 选择最初是哪个选项 选定的是不确定的.笔记.自从 现有的实现可以解决这个问题 情况不同,当前 规范不同于RFC 1866 ([RFC1866]第8.1.3节),其中 状态:初始状态具有 选择第一个选项,除非 SELECTED属性存在于任何 的元素. 自用户以来 代理人的行为有所不同,作者应该 确保每个菜单都包含一个 默认的预选选项.

If no OPTION element has the selected attribute set, user agent behavior for choosing which option is initially selected is undefined. Note. Since existing implementations handle this case differently, the current specification differs from RFC 1866 ([RFC1866] section 8.1.3), which states: The initial state has the first option selected, unless a SELECTED attribute is present on any of the elements. Since user agent behavior differs, authors should ensure that each menu includes a default pre-selected OPTION.

如果选择了一个OPTION元素 属性集,应该是 预选.如果SELECT元素 设置了多个属性,并且 一个以上的OPTION元素具有 选择属性集,他们应该 全部预先选择.已经被考虑了 如果有多个OPTION则报错 元素具有选定的属性集 并且SELECT元素没有 多重属性集.用户 代理商的处理方式可能有所不同 此错误,但不应该预先选择 不止一种选择.

If one OPTION element has the selected attribute set, it should be pre-selected. If the SELECT element has the multiple attribute set and more than one OPTION element has the selected attribute set, they should all be pre-selected. It is considered an error if more than one OPTION element has the selected attribute set and the SELECT element does not have the multiple attribute set. User agents may vary in how they handle this error, but should not pre-select more than one choice.

这篇关于提交空的选择倍数是否有标准的客户行为?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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