Side by side - disable columns if checked box | XM Community
Question

Side by side - disable columns if checked box

  • 9 July 2019
  • 1 reply
  • 57 views

Hi there,

I am creating a survey where participants have to rate questions/statements according to some criteria. We'd like to give them the option of not answering a question if it is beyond their expertise/knowledge. Using validations we have already implemented that an answer will be accepted if either all columns are answered for a statement OR the box 'outside of expertise' is checked. The problem is, they are now able to answer 'this is outside of my expertise' AND answer the other columns anyway. Not that they'd do this on purpose, but we would like to prevent this by disabling the other columns as soon as the box is checked (e.g. hide the other columns or prevent them from clicking the dropdown menus, something like that). This is way beyond my programming knowledge and skills, which is why I am reaching out for help.

Is this possible to do with JavaScript per question or in the CSS of the survey? If yes, how? Please see the screenshot below for reference.

!

Thank you in advance.

Jacky

1 reply

Userlevel 5
Badge +7
This StackOverflow article has a jQuery one-liner to find an element and make it "disabled" (or readonly in javaScript). You could use custom JS to see if checkboxObject.checked = true, set all dropdowns to disabled. A step further would be using CSS to gray out the cells that make up the columns. It'd be a lot of repetitive CSS since there are 3 cells per row in a Side-by-Side (a main cell and a cell on the left and right used for padding), but it'd definitely be doable.

Leave a Reply