Skip to content

Commit 1c6fab9

Browse files
committed
Javascript fixups
1 parent cd784b1 commit 1c6fab9

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

client/dist/main.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/src/js/partialuserforms/partialsubmission.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const getElementValue = (element, fieldName) => {
2727
}
2828
return "";
2929
}
30-
if (element.getAttribute('type') === 'file') {
30+
if (element.getAttribute('type') === 'file' && element.files.length > 0) {
3131
return element.files[0];
3232
}
3333

@@ -42,8 +42,7 @@ const submitPartial = () => {
4242
if (!data.has(fieldName)) {
4343
if (typeof value === 'object' && element.getAttribute('type') === 'file') {
4444
data.append(fieldName, value);
45-
}
46-
else if (typeof value === 'object') {
45+
} else if (typeof value === 'object') {
4746
value.forEach((arrayValue) => {
4847
data.append(fieldName, arrayValue);
4948
});
@@ -84,7 +83,7 @@ const abortPendingSubmissions = () => {
8483
}
8584
};
8685

87-
export default function() {
86+
export default function () {
8887
buttons().forEach(attachSubmitPartial);
8988
abortPendingSubmissions();
9089
}

0 commit comments

Comments
 (0)