I have met issue while try get a default "no" value from checkbox when it is not "checked" on webpage. however, only the "yes" value pass to the form by name "testName" when I click the checkbox. But I want get result like a list of [yes,yes,no,no] from request.form.getlist
<form action="{{url_for('show_select')}}" method="post">
{% for entry in entries %}
<tr>
<td>
<input name='testName' type='checkbox' onclick="checkboxtest();" value='No'>
</td>
</tr>
{%endfor %}
<div align="right">
<button type="submit" class="btn btn-primary">Go</button>
</div>
</form>
<script>
function checkboxtest(){
var x = document.getElementsByName("testName");
var i;
for (i = 0; i < x.length; i++) {
if (x[i].checked == true) {
x[i].value = "Yes";}
}
}
</script>