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這類控件的值,都是徒勞的,必須想其它辦法曲線實現。

相關文章
相關標籤/搜索