表单发布后,禁用的文本字段是否会提交?
如果我通过POST提交禁用的文本字段,那么结果值会在操作页面上显示出来吗?
If I submit a disabled text field via POST, what will the resulting value be on the action page?
例如,我有:
<table border=0 cellpadding=4 cellspacing=0>
<tr><td>
<input type="checkbox" id="chk_$item"
onClick="javascript:handleClick('$item')">
</td><td>
<input type="text" id="txt_$item" name="addresses[]" value="$item">
</td></tr>
<tr><td>
...etc...
</td></tr>
</table>
chk_ $ item
会被检查,如果不是,则会禁用 txt_ $ item
文本字段。
the handleClick()
javascript function checks if chk_$item
is checked, if not, it disables the txt_$item
text field.
当我提交它时,所有文本字段都将转到PHP脚本的 addresses []
数组中。
When I submit it, all of the text fields go to an addresses[]
array in a PHP script.
但是,如果该字段被禁用,我可以阻止该字段提交任何内容吗?它会默认执行此操作吗?如果不是,我应该如何改变行为? (我真的不想清除这些字段,当他们被禁用)。
But, can I prevent the field from submitting anything if it is disabled? Will it do this by default? If not, how should I change the behavior? (I really don't want to clear the fields when they get disabled).
禁用的输入将不会与形成;这是禁用
的定义行为的一部分,参见 W3C HTML 4.01表单文档。
Disabled inputs will not be submitted with the form; that's part of the defined behavior of disabled
, cf. W3C HTML 4.01 Form docs.