On my page i have a table which includes an 'add row' button, so a user can add more rows if they desire. The row is added by cloning the last row in the table. Within the row I would like to put two checkboxs.
<td class = ''> <input class = '' type='checkbox' name ='installed_by_cm' value='1'/> </td>
<td class = ''> <input class = '' type='checkbox' name ='installed_after_cm' value='1'/> </td>
This means that there is multiple checkboxes with the same 'name' tag, something that i require for my data handling later in the code. I use flasks request.form.getlist() to obtain the information in the python backend.
Since the checkbox type default is none and i can not use a hidden input as it will always be collected by the request, I am unable to find a way to make the checkbox send a 1 when checked and a 0 when not checked. Any help would be greatly appriciated.
name="installed_by_cm[]"otherwise the checkboxes will overwrite one each other. Mostly i'd go with an identifier e.gname="installed_by_cm[<?= $id ?>]"(example in PHP)