Commit 9bccc6a5 authored by Skia's avatar Skia
Browse files

Small fix in the JS

parent e66d9bd4
...@@ -72,7 +72,7 @@ $("form").submit(function (event) { ...@@ -72,7 +72,7 @@ $("form").submit(function (event) {
this.insertBefore(errorlist, this.firstElementChild); this.insertBefore(errorlist, this.firstElementChild);
} }
while(errorlist.childElementCount > 0) while(errorlist.childElementCount > 0)
errorlist.removeChild(errorlist.firstElementChild); errorlist.removeChild(errorlist.firstElementChild);
var progress; var progress;
...@@ -96,7 +96,7 @@ $("form").submit(function (event) { ...@@ -96,7 +96,7 @@ $("form").submit(function (event) {
processData: false, processData: false,
contentType: false, contentType: false,
success: onSuccess success: onSuccess
}) });
} }
var images = formData.getAll('images'); var images = formData.getAll('images');
...@@ -141,7 +141,10 @@ $("form").submit(function (event) { ...@@ -141,7 +141,10 @@ $("form").submit(function (event) {
} }
function onSuccess(image, data, status, jqXHR) { function onSuccess(image, data, status, jqXHR) {
var errors = Array.from($(data).find('.errorlist.nonfield')[0].children); if ($(data).find('.errorlist.nonfield')[0])
var errors = Array.from($(data).find('.errorlist.nonfield')[0].children);
else
var errors = []
while(errors.length > 0) while(errors.length > 0)
errorlist.appendChild(errors.shift()); errorlist.appendChild(errors.shift());
progress.value = ++completeCount / imagesCount; progress.value = ++completeCount / imagesCount;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment