Skip to content
This repository has been archived by the owner on Jan 1, 2023. It is now read-only.

Commit

Permalink
fix: return empy value when checkbox not checked
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigoreeis committed May 26, 2021
1 parent 92ac86f commit a3d88f9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion form2/dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions form2/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ export const getFormData = (form) => {
const isCheckbox = (el.type && (el.type == 'checkbox'))
const isFile = (el.type && (el.type == 'file'))

acc[el.name] = el.value
acc[el.name] = el.form[el.name].value

if (isCheckbox && el.checked) {
acc[el.name] = el.value
if (isCheckbox) {
acc[el.name] = el.checked ? el.value : ''
}

if (isFile && el.value) {
Expand Down

0 comments on commit a3d88f9

Please sign in to comment.