Search code examples
htmlradio-buttonlatin-square

Enforce "sudoku-like" (latin square) constraint on radio buttons


In my GUI, I need a 3x3 array of radio-buttons, constrained so that only one can be selected in each row, and only one can be selected in each column.

Is this possible client-side, without Javascript (I'm happy to use javascript, but would like a fallback for when JavaScript is off)? Or is my only option Javascript and server-side enforcement?


Solution

  • Realistically, your only option is JavaScript. Enforcing a by-row or by-column constraint on your inputs is obviously quite possible, but it wouldn't be possible to do this in the "sudoku-like" way you're thinking since each set of controls in a group must share the same name.