禁用时,InputText值为null [英] InputText value null when disabled is true

查看:164
本文介绍了禁用时,InputText值为null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的JSF页面上有一个inputText,并附加了一个JavaScript日历弹出窗口。
有条件我将inputText disabled属性设置为true和false。

I have an inputText on my JSF page and a JavaScript calendar popup is attached to it. Conditionally I'm setting the inputText disabled property to true and false.

当我设置 disabled = true 当我然后将JSF值写入数据库时​​,inputText中的值为null。我相信这是由于 disabled = true

When I set disabled = true and when I then write JSF values to the database, the value in inputText is null. I believe this is due to the disabled = true.

有没有办法保留inputText中的值框即使 disabled = true

Is there any way to retain the value in the inputText box even though disabled = true?

我使用的是JSF 1.1。

I am using JSF 1.1.

推荐答案

另一种解决方法是在提交表单时临时启用此输入,并在模型更新后再次禁用它。还有一些解决方案使用具有相同ID的隐藏输入,但不幸的是我不记得它是如何工作的。

Another workaround would be to temporarily enable this input when submitting the form, and after model is updated, disable it again. There also was some solution with using hidden input with the same id, but unfortunately I don't remember how it exactly works.

这篇关于禁用时,InputText值为null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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