We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 706e830 commit 254da2fCopy full SHA for 254da2f
js/formDataToJson.js
@@ -37,6 +37,14 @@ function getSelectedOptions(options) {
37
return selectedOptions;
38
}
39
40
+function isEmptyObject(obj) {
41
+ return Object.values(obj).every(value =>
42
+ value === "" ||
43
+ value === null ||
44
+ value === undefined
45
+ );
46
+}
47
+
48
// Populates fields with form data
49
function populateObject(data, fields) {
50
let reorderedObject = {}
@@ -45,7 +53,7 @@ function populateObject(data, fields) {
53
let value = data[field];
54
55
// Does not assign optional properties with blank values
- if (value == null || value === "") {
56
+ if (value == null || value === "" || (Array.isArray(value) && typeof value[0] === 'object' && isEmptyObject(value[0]))) {
57
continue;
58
51
59
0 commit comments