if an h:selectManyCheckbox has a attribute readonly="true", the user could not able to check or uncheck the checkbox. but able to click on it, why?
As on every other HTML input element, the readonly attribute only applies on the input element's value, not on the checkbox's state. This is indeed pretty unintuitive.
You can use JavaScript to let the onclick return false when the readonly state is true.
onclick="return #{!bean.readonly}" readonly="#{bean.readonly}"
Please note that this unintuitive behaviour is not related to JSF, but to HTML.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With