0
votes

In an XPage I have a CheckBox control bound to a property of a bean (called product). If I make that property a boolean like so..

private boolean selected = true;
public boolean isSelected() {
    return selected;
};
public void setSelected(boolean selected) {
    this.selected = selected;
};

and bind the checkbox using EL as #{product.selected) then the page initially opens fine but hangs on a partial refresh, however I can't see any errors in the logs.

If I add another wrapper getter/setter in the bean to return a text version like so:

public String getSelectedTxt() {
    return String.valueOf(selected);
}
public void setSelectedTxt(String selectedTxt) {
    selected = Boolean.parseBoolean(selectedTxt);
}

then bind the checkbox to #{product.selectedTxt} and make the uncheckedValue="false" and checkedValue="true". It works!

In version 9 it works straight against the boolean version without the need to convert to text.

So the question is does this sound like a bug in 8.5.3 with mapping checkbox controls to boolean values (has anyone done that before?), or am I approaching this the wrong way?

1
I'm surprised that it works in Notes 9, since the behavior all along in Notes was for checkbox values to be stored as strings. So, no, I don't thing it was a bug in 8.5.3, but a new capability in Notes 9.David Navarre
Thanks David. I think that assumes that the XPages controls are there purely to be bound to a notes document data source, which if so I completely understand why the checkbox needs to point at a string value. If there are there to be bound to any potential datasource such as beans then I would have expected the boolean value to work. I'll treat it as a new, and useful!, feature in Notes 9 and stick to Strings values when on earlier releases. Cheers!Martin Holland

1 Answers

0
votes

Checkboxes are one of a range of options for displaying the contents of Notes fields of type "Keywords". Keywords are Text fields that have a finite set of values. While you may think of a Checkbox as being a Boolean control that was not their original purpose or intent. So I would not look upon the 8.5.3 implementation as a bug. If the 9.0 behavior has changed to support boolean values then that is good news.