checkbox always sends value
issaev opened this issue · 4 comments
When submitting a checkbox, it always behaves as checked - ie the "value" attribute is sent
@issaev Do you have a link to your code to share so the dwyl community could try to help you debug?
I have the same issue, the checkbox is always sent "on". Any progress on this?
In form-submission-handler.js, it grabs every form element's .value attribute. Unfortunately, for checkboxes, this is always "on" and we need the .checked attribute instead. Fixing the code now, will close once done.
Hi, not entirely sure if this is the right place to post this but this fix does not catch the usecase where there is a single checkbox.
I suspect this is the reason issue #265 was brought up as well.
A potential solution could be this when we collect form data:
// if checkbox, then get the checked value
if (element.type == 'checkbox') {
formData[name] = "";
if (element.checked) {
formData[name] = element.value;
}
}
where if the checkbox is checked then the sheet's cell would show the checkbox value, otherwise is blank.
Thanks for all your work.