Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

InputText value null when disabled is true [duplicate]

Tags:

java

jsf

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.

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.

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

I am using JSF 1.1.

like image 571
Jacob Avatar asked Feb 24 '23 08:02

Jacob


2 Answers

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.

like image 109
jFrenetic Avatar answered Feb 25 '23 23:02

jFrenetic


You should try readonly=true instead of disabled=true (just like in plain HTML)

like image 28
Tristan Avatar answered Feb 25 '23 21:02

Tristan