0

How can I mark a Spring Checkbox as readOnly instead of disabled? I want to do it using a simple attribute like readonly = "true" but this does not work. I am hoping to avoid writing a javascript just for this.

Victor
  • 16,609
  • 71
  • 229
  • 409

1 Answers1

0

According to this documentation the option which should do the trick is: disabled.

ŁukaszBachman
  • 33,595
  • 11
  • 64
  • 74
  • please leave a comment while downcasting. I might be wrong and I would like to learn from it. – ŁukaszBachman Feb 18 '12 at 21:28
  • 1
    Sorry about that. In the question, I mentioned that I do not want to mark it as disabled. – Victor Mar 26 '12 at 15:38
  • Ohh, ok. I didn't notice that fact, since as far as I know, there is no such state as `read only` for checkboxes in HTML. See http://stackoverflow.com/questions/155291/can-html-checkboxes-be-set-to-readonly You could try playing around with JavaScript and force a quick check: `if (state_changes) checkbox.setPrevState()`. This is an ugly hack, but could work. – ŁukaszBachman Mar 27 '12 at 06:07