Siva
Siva

Reputation: 63

h:inputText not updating from bean automatically

I have an h:inputText in my form. The value is not properly updating when I update its panelGroup. JSF version is 2.1.13.

If I used disable="true" OR displaying the bean value in h:outputText OR refresh the page its updating properly. But by default its not happening.

<span style="min-width: 100px;"> First Name: #{NewPatient.newPatientBean.firstName}</span>
                <h:inputText id="fname" 
                    value="#{NewPatient.newPatientBean.firstName}"
                    onchange="initialCaps(this);" maxlength="50">
                    <f:ajax execute="@this" event="blur"/>
                </h:inputText>

In the above code

First Name: #{NewPatient.newPatientBean.firstName} is properly updating but the inputText is not.

Kindly let me know the mistake and solution for the above issue. Thanks in advance.

Upvotes: 1

Views: 4429

Answers (1)

BalusC
BalusC

Reputation: 1109625

That will happen when a validation error occurred during the current or previous postbacks. The input component will then not redisplay the model value, but only the initially submitted value when the component itself failed validation or the local value when another component in the same form failed validation.

As the concrete functional requirement is completely absent in the question, it's not possible to propose the right solution for this. So here's just a link which explains the problem more generically which should give new insights as to the cause and the solution: How can I populate a text field using PrimeFaces AJAX after validation errors occur?

Upvotes: 2

Related Questions