I've got a simple question here. If I'm asking it is because I can't find any answer neither here nor google.
I'm using IceFaces 3.1.
I'm filling an inputtext from a java bean. It only works when it has the attribute disabled="true".
Here is the xhtml code:
<h:inputText value="#{PageCode.quantity}" disabled="false"/>
And the java code (called form somewhere):
this.setQuantity(1);
It doesn't contains the value. It's not CSS because I've debugged it, and there is a null value.
But if I change it to:
<h:inputText value="#{PageCode.quantity}" disabled="true"/>
It works. But I need it enabled so as to edit it an so on...
How can it be posible?
Apparently you called setQuantity(1)
at the wrong moment.
When not disabled, the <h:inputText>
will set its submitted value during update model values phase. So if you have manually set it before the update model values phase (e.g. during validations phase inside a validator or a value change listener), then it would be overridden by the submitted value later. If the component is disabled, then it won't set its submitted value. This explains the symptoms you're seeing.
You need to make sure that you call setQuantity(1)
during invoke action phase, which is after the update model values phase.
Based on most commonly occurring beginner's mistakes, I guess that you actually did the job in a valueChangeListener
method while you're not interested in the old value. You shouldn't do that. You should use <f:ajax listener>
instead.