2

I have a form that has an inputtext where the operator enters the clientid and click on "search", when the search is done the other fields in the form are populated correctly.

Then I have the button "new record" that calls a procedure that creates another object (not a customer) and needs to persist it, when the other object is created in the bean it takes every field from the form except a timestamp.

When the object is persisted only the timestamp is in the DB, all the form values are set to null.

<h:form id="myForm">
    <h:outputText value="Customer number" /> 
    <h:inputText id="cIdentidad" value="#{custBean.custID}" />
    <p:commandButton  process="@all" update="@all"  action="#{custBean.populateFields(custBean.custID)}" value="Search" />               
    <p:growl />

    <h:panelGrid id="newCust" columns="2" style="margin-top: 15px">
        <h:outputText value="Name" /> 
        <h:inputText id="name" value="#{custBean.name}" disabled="true"/>
        <h:outputText value="more fields" /> 
        <h:inputText id="nroAgenda" value="#{custBean.morefields}" disabled="true"/>
    </h:panelGrid>

    <p:commandButton  process="@all" update="@all"  action="#{custBean.newRecord()}" value="New record" />
</h:form>
Vasil Lukach
  • 3,383
  • 3
  • 27
  • 36
Alexev
  • 157
  • 1
  • 15

1 Answers1

1

The h:inputText's are disabled, so the value will not be submitted to the server. Maybe you're looking for readonly="true".

Also I would'nt use @all everywhere but rather @form. update="@all" has a special meaning.

Also see this answer.

Jaqen H'ghar
  • 4,293
  • 2
  • 12
  • 24