0
votes

I have a selectBooleanCheckbox with a backing bean that sets the value of the checkbox to true. This shows the box checked on render. (What I want) However when you click the box (assuming it should remove the check) it continues to be checked. Only after a second click does the box become unchecked. This leads to another issue. If the box is never clicked (assuming the boolean should equal true as the value has not changed) the value is saved as false and screwing with my logic. Due to requirements I need to have the box checked on load. Note:The Ajax seems to be working correctly. Here is my code:

html:

 <p:selectBooleanCheckbox id="testBox"
                widgetVar="textBoxVar"
                value="#{bean.testValue}">
                <p:ajax event="change" process="testValue">
                    <s:conversationId/>
                </p:ajax>
 </p:selectBooleanCheckbox>

bean:

 Boolean testValue = 'true';

 public void setTestValue(Boolean test1){
    this.testValue = test1; 
  }

 public Boolean getTestValue(){
     return this.test;
 }
1

1 Answers

0
votes

First this construction:

Boolean testValue = 'true';

doesn't exist in Java, so I will consider this just as typing error.

Second your process="testValue" doesn't seem right. You don't have component with this ID, at least not here. If you want to process just this p:selectBooleanCheckbox use process="testBox" or process="@this".

Also, as I know s:conversationId is from JBoss Seam framework, I don't know is that work correct with p:ajax that is job for you to check, but be prepared that this maybe will no work correct with Seam conversations.