Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ADF Faces/RC: unchecked selectBooleanCheckbox PPR issue

User_HWHT9Mar 9 2009 — edited Mar 18 2009
Hi gang

I was hoping somebody could give me a shove in the right direction with the following problem please. I don't think it's a bug, just something I don't understand about ADF Faces (under JDev 10.1.3.4).

I have a page with a checkbox and commandButton, the commandButton is enabled/disabled through a PPR event on the checkbox. My page tag's:
<af:selectBooleanCheckbox
  id="myCheckbox"
  text="Some Checkbox"
  label="Select Me"
  autosubmit="true"
  value="#{myBean.checkboxValue}"
  valueChangeListener="#{myBean.doValueChangeEvent}"/>
<af:commandButton
  text="Do something"
  disabled="#{!myBean.checkboxValue}"
  partialTriggers="myCheckbox"/>
My request level bean code:
public class MyBean {   
    boolean checkboxValue = false;

    public void doValueChangeEvent(ValueChangeEvent valueChangeEvent) {        int fish = 1;    }

    public void setCheckboxValue(boolean checkboxValue) {        this.checkboxValue = checkboxValue;    }
    public boolean isCheckboxValue() {        return checkboxValue;    }
}
On running the page, the checkbox is not selected (as per init value from bean) and the commandButton is disabled. Selecting the checkbox, the commandButton becomes enabled through the PPR event. However, then unselecting the checkbox, the commandButton remains enabled?

I'm not sure why this is occurring, I suspect it has to do with the underlying behaviour of HTML; unchecked checkboxes are not submitted as part of the POST back to the server. Using Firebug with Firefox seems to show this HTML behaviour. Given this fact, presumably as ADF Faces doesn't get a value change for the HTML checkbox, ADF ignores the PPR event in this case?

A symptom of the problem: with the debugger I can see for the checkbox-select the doValueChangeEvent() and setCheckboxValue() methods in the bean are called, but for the checkbox-unselect they aren't. This is inline with the assumption about the HTML-checkbox behaviour above.

However somewhat confusingly, if I change the managed bean to a session scoped bean, the commandButton correctly disables itself on the checkbox-unselect, and I can see the bean doValueChangeEvent() and setCheckboxValue() methods called.

Anybody have an idea of what's going on here?

Thanks & regards,

CM.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 15 2009
Added on Mar 9 2009
10 comments
8,018 views