A while ago (in the old forum) I promised to tidy up & share some of my examples relating to checkboxes.
Can't recall if this code was ever posted so thought I'd share it here anyway in case it's of help to anyone.

Background:

I was adding many pages (similar to each other) of manually entered tables filled with checkboxes
Problem 1: This was tedious, time consuming & difficult to maintain especially over multiple pages
Problem 2: Adding or removing checkboxes affects which (later) checkboxes are ticked / unticked
Problem 3: Problem 2 can be solved by using named checkboxes but these look awful in a table

Usage:

{{lua CheckList.lua, heading, row 1:row 2:row 3, col 1:col 2:col 3}} 

Notes:

heading = the title you want to see in the top left of the resulting table
row 1... = colon separated list of row labels
col 1... = colon separated list of column labels

Output:

(not sure how to do a table or add a screenshot in this forum so you may need to use your imagination)

 _________________________________________
|  heading  |  col 1  |  col 2  |  col 3  |
 _________________________________________
|  row 1    |    X    |    X    |    X    |
|  row 2    |    X    |    X    |    X    |
|  row 3    |    X    |    X    |    X    |
 _________________________________________

Lua Code:

CheckList.lua

Title=args[1]
RowLabels=args[2]
ColLabels=args[3]

function CheckList(title, row_labels, col_labels)
   O=title
   for col = 1, #col_labels do
      O=O .. " | " .. col_labels[col]
      col_labels[col] = string.gsub(col_labels[col], "%d", function(d) return string.format("%c", d+64) end)
   end
   O=O .. "\n:--:"
   for col = 1, #col_labels do
      O=O .. "|:--:"
   end
   O=O .. "\n"
   for row = 1, #row_labels do
      O=O .. row_labels[row]
      row_labels[row] = string.gsub(row_labels[row], "%d", function(d) return string.format("%c", d+64) end)
      for col = 1, #col_labels do
         O=O .. " | {{check " .. row_labels[row] .. col_labels[col] .. "}}"
      end
      O=O .. "\n"
   end 
return O
end

function split(stringarray, sep)
  array={}; i=1
  for str in string.gmatch(stringarray, "[^"..sep.."]+") do
    array[i]=str; i=i+1
  end
  return array
end

Rows=split(RowLabels,":")
Cols=split(ColLabels,":")

Y=CheckList(Title, Rows, Cols)

S = "{{stylesheet CheckList.css}}\n"

Y = S .. Y

return (Y)

CSS Code:

CheckList.css

.checked_checkbox {
   display: none;
}

.unchecked_checkbox {
    display: none;
}

Recommendation:

If adding the same checklist to lots of pages then do so via a static include or purpose built lua loader with the title/row/column parameters baked in. This way when you decide to redesign the layout and / or content you'll only have to edit one version

Warnings:

  • Avoid titles on any two rows or columns which are the same (ignoring case, spaces, and non-alphanumeric values). The reason for this is that I label each checkbox with a concatenation of the row title and the column title & this needs to be unique
  • Changing any row or column names will lose the checkbox statuses for everything in those rows / columns