The problem is, i have a form where some inputs should not be rendered when including a new record. this inputs will be rendered only for updating a record. To achive this feature I used the rendered property (something like rendered="#{mBean.entity.id != null}". It works fine unless I have a validation fail in the form. when I select a record for updating the form is ok but if press the Save button with some incorrect input it shows the validation message but hide all the "rendered=#{mBean.entity.id != null}" inputs even the id still null. How can I fix this?
I am working with primefaces 2.2.1 in tomcat7.
my xhtml code
Code: Select all
<f:metadata>
<f:viewParam name="id" value="#{myMBean.selected.id}" />
</f:metadata>
<h:form id="formu" >
<p:focus />
<h:inputHidden id="hdnId" value="#{myMBean.selected.id}"/>
<h:panelGrid columns="2" columnClasses="column" cellpadding="5">
<h:outputLabel value="#{msgs.lbl_codigo}:"
rendered="#{myMBean.selected.id != null}" />
<h:outputLabel id="lblId" value="#{myMBean.selected.id}"
rendered="#{myMBean.selected.id != null}" />
<h:outputLabel value="#{msgs.lbl_nome}:" />
<p:inputText id="txtUsuario" value="#{myMBean.selected.name}"
label="#{msgs.lbl_nome}" maxlength="200" required="true" size="100" />
<h:outputLabel value="#{msgs.lbl_login }:" />
<p:inputText id="txtLogin" value="#{myMBean.selected.login}"
label="#{msgs.lbl_login}" maxlength="30" required="true" size="30" />
</h:panelGrid>
....
<p:commandButton value="#{msgs.btn_gravar}"
action="#{CadUsuarioBean.actionGravar}"
image="ui-icon ui-icon-disk" process="@this formu" ajax="false" />
Code: Select all
public String actionGravar() {
nUser.save(this.selected);
this.setSelected(null);
info("Record saved."); //Faces message
return "user-list";
}
tks.