0

Consider the following situation: There exists a column in a table with label "X". X contains a checkbox, which can be checked or unchecked. To be more precise here is the code:

<h:form id="form">
  <rich:dataTable id="table"
    <rich:column>
      <f:facet name="header">
        <h:outputLabel value="X" />
          </f:facet>
            <h:selectBooleanCheckbox id="x" readonly="true"
              disabled="true"
              value="#{some condition}"
              styleClass="#{foo() ? 'inputChanged' : '' center" />
              .
              .
              .

The problem i got is: It is not quite clear to decide wether the checkbox is checked or not. The problem is, that the checkbox has to be disabled, else it gets focussed and one can click the check box. Even though this does not have any impact on the data in the backend, i don't want this to happen. The costumer told me, that you cant decide quite well, if the checkbox is marked or not.

Is there a way to get the checkbox not disabled while a user can't make any changes? Or do you have any other idea how to make this more visible to a costumer?

Chris311
  • 3,794
  • 9
  • 46
  • 80
  • check boxes can't be read only, because it's not a value change, it's a state change. there aren't really any clean solutions I think this question was already answered here unless I'm missing something: http://stackoverflow.com/questions/155291/can-html-checkboxes-be-set-to-readonly – Dani May 15 '14 at 15:29
  • Ok, then let's do a workaround. Is it possible to redifine 'disabled' for the disabled checkboxes? E.g. let them be red or something. I experimented with the css, but sadly without any progress. – Chris311 May 20 '14 at 07:31
  • I added the following to my .css: input[type="checkbox"][disabled] { background: white; size="100000";} This has no impact at all... – Chris311 May 20 '14 at 11:32

1 Answers1

0

The following worked:

input[type=checkbox]:not(:checked) {
    outline:2px solid red;
}

This way, you can override the style of an unchecked checkbox so that it has a red border.

Chris311
  • 3,794
  • 9
  • 46
  • 80