开发者

why readonly attribute doesn't works for h:selectManyCheckbox?

开发者_Python百科

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜