W3C文档,中对于能够POST的控件的说明

版权声明: 本文由 一只博客 发表于 bloghome博客html

文章连接: https://www.bloghome.com.cn/user/cnn237111ide

http://www.w3.org/TR/html4/interact/forms.html#h-17.13.2post

官方文档描述ui

17.13.2 Successful controlsspa

A successful control is "valid" for submission. Every successful control has its control name paired with its current value as part of the submitted form data set. A successful control must be defined within a FORM element and must have a control name.rest

However:orm

  • Controls that are disabled cannot be successful.server

  • If a form contains more than one submit button, only the activated submit button is successful.htm

  • All "on" checkboxes may be successful.blog

  • For radio buttons that share the same value of the name attribute, only the "on" radio button may be successful.

  • For menus, the control name is provided by a SELECT element and values are provided by OPTION elements. Only selected options may be successful. When no options are selected, the control is not successful and neither the name nor any values are submitted to the server when the form is submitted.

  • The current value of a file select is a list of one or more file names. Upon submission of the form, the contents of each file are submitted with the rest of the form data. The file contents are packaged according to the form's content type.

  • The current value of an object control is determined by the object's implementation.

If a control doesn't have a current value when the form is submitted, user agents are not required to treat it as a successful control.

Furthermore, user agents should not consider the following controls successful:

Hidden controls and controls that are not rendered because of style sheet settings may still be successful. For example:

<FORM action="..." method="post"> <P> <INPUT type="password" style="display:none" name="invisible-password" value="mypassword"> </FORM>

will still cause a value to be paired with the name "invisible-password" and submitted with the form.

 

 

其中清楚的说明了未选中的checkbox和禁用的控件不是有效控件,不会被POST。所以想要post这类控件的值,都是徒劳的,必须想其它办法曲线实现。

相关文章
相关标签/搜索