Widget:File upload: verschil tussen versies
Uit Dorpsbelang Den Hout
Regel 27: | Regel 27: | ||
var settingsFilename<!--{if (isset($filename) && $filename!="")}--> = "<!--{$filename}-->"<!--{/if}-->; | var settingsFilename<!--{if (isset($filename) && $filename!="")}--> = "<!--{$filename}-->"<!--{/if}-->; | ||
+ | var fileInput = document.getElementById('widget-file-upload-files'); | ||
+ | |||
console.log(createFilename('hoi')) | console.log(createFilename('hoi')) | ||
Regel 47: | Regel 49: | ||
output = output.replace('<'+match+'>', filename); | output = output.replace('<'+match+'>', filename); | ||
}else{ | }else{ | ||
− | var | + | var input = fileInput.closest('form').querySelector('[name="'+match+'"]'); |
− | if( | + | if(input){ |
− | val = | + | val = input.value; |
output = output.replace('<'+match+'>', val); | output = output.replace('<'+match+'>', val); | ||
} | } | ||
Regel 70: | Regel 72: | ||
function uploadFiles(evt){ | function uploadFiles(evt){ | ||
− | var files = | + | var files = fileInput.files; |
var proms = []; | var proms = []; | ||
for(i = 0; i < files.length; ++i){ | for(i = 0; i < files.length; ++i){ | ||
Regel 122: | Regel 124: | ||
function createPreviews(){ | function createPreviews(){ | ||
− | var filesSelected = | + | var filesSelected = fileInput.files; |
if (filesSelected.length > 0) { | if (filesSelected.length > 0) { | ||
Versie van 7 sep 2020 09:23
This is the Widget:Multi upload page. It should be called in the following format:
{{#widget:Multi upload }}