禁用输入的值将不会提交 [英] Values of disabled inputs will not be submitted

查看:103
本文介绍了禁用输入的值将不会提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我在Firefox中由Firebug发现的.

This is what I found by Firebug in Firefox.

在其他浏览器中也一样吗?

Is it the same in other browsers?

如果是这样,这是什么原因?

If so, what's the reason for this?

推荐答案

是的,所有浏览器不应提交已禁用的输入,因为它们是只读的.

Yes, all browsers should not submit the disabled inputs, as they are read-only.

更多信息(第17.12.1节)

More information (section 17.12.1)

属性定义

disabled [CI]为表单控件设置时,此布尔属性 禁用用户输入控件.设置后,禁用属性 对元素有以下影响:

Attribute definitions

disabled [CI] When set for a form control, this Boolean attribute disables the control for user input. When set, the disabled attribute has the following effects on an element:

  • 禁用的控件无法获得焦点.
  • 在标签导航中跳过了禁用的控件.
  • 禁用的控件不能成功.

以下元素支持禁用的属性:BUTTON,INPUT, OPTGROUP,OPTION,SELECT和TEXTAREA.

The following elements support the disabled attribute: BUTTON, INPUT, OPTGROUP, OPTION, SELECT, and TEXTAREA.

此属性是继承的,但本地声明会覆盖 继承的值.

This attribute is inherited but local declarations override the inherited value.

如何显示禁用的元素取决于用户代理.为了 例如,一些用户代理变灰",并且显示为灰色".禁用的菜单项,按钮 标签等.

How disabled elements are rendered depends on the user agent. For example, some user agents "gray out" disabled menu items, button labels, etc.

在此示例中,INPUT元素被禁用.因此,它不能 接收用户输入的内容,也不会通过表单提交其值.

In this example, the INPUT element is disabled. Therefore, it cannot receive user input nor will its value be submitted with the form.

<INPUT disabled name="fred" value="stone">

注意.动态修改禁用值的唯一方法 属性是通过脚本实现的.

Note. The only way to modify dynamically the value of the disabled attribute is through a script.

这篇关于禁用输入的值将不会提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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