Skip to content

Commit 69a8201

Browse files
committed
gpfup-count-files-groups.js: Added snippet to count files in groups.
1 parent 28c116c commit 69a8201

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

gp-file-upload-pro/gpfup-count-files-groups.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const formId = GFFORMID;
1010
const countMapping = {
1111
5: [1, 3, 4], // Number Field ID 5 counts files from File Upload Field IDs 1, 3, 4
1212
10: [7, 8, 9] // Number Field ID 10 counts files from File Upload Field IDs 7, 8, 9
13-
// Add more mappings if needed
13+
// Add more mappings as needed: countFieldID: [uploadFieldID1, uploadFieldID2, ...]
1414
};
1515

1616
// Find all GPFUP keys for the form
@@ -34,7 +34,7 @@ function updateAllCountFields() {
3434
Object.entries(countMapping).forEach(([countFieldID, uploadFieldIDs]) => {
3535
const total = uploadFieldIDs.reduce((sum, uploadFieldID) => {
3636
const key = 'GPFUP_' + formId + '_' + uploadFieldID;
37-
const store = window[key] && window[key].$store;
37+
const store = window[key]?.$store;
3838
return sum + (store ? (store.state.files.length || 0) : 0);
3939
}, 0);
4040

0 commit comments

Comments
 (0)