How to keep a check box true after an error message is displayed?

Asked

Viewed 120 times

1

How can I keep a checkbox true when I display error message? Every time I display a errorMessage my checkbox turns into false. How can I solve this problem? I am using jsf2.0 and primefaces.

This is the button that calls a method:

    <p:commandButton styleClass="btIcon" 
                                 value="Consolidar"
                                 image="addIcon"
                                 process="@this :formCadastro"
                                 actionListener="#{bean.addConsolidacao}"
                                 onclick="carregando.show();"
                                 oncomplete="carregando.hide();" 
                                 rendered="true" 
                                 update="@this :formCadastro :formPanel" />

1 answer

1

I noticed the problem, when the page is rerenderized the checkbox is not part of the entity. The solution is only to define a transient in the entity in order to manipulate it.

    @Transient
private Boolean acaoCheck;

public Boolean getAcaoCheck() {
    return acaoCheck;
}

public void setAcaoCheck(Boolean acaoCheck) {
    this.acaoCheck = acaoCheck;
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.