diff --git a/static/js/create.js b/static/js/create.js index 1ab1679..7d23a19 100644 --- a/static/js/create.js +++ b/static/js/create.js @@ -71,10 +71,10 @@ function fillDropdownByValue(value, dropdownToFill) { // Hides the default browser-upload-form and replaces it by an button function customizeUploadButton() { - $(".tfile").before(''); - $(".tfile").hide(); + $("input.file").before(''); + $("input.file").hide(); $('body').on('click', '#button-file', function() { - $(".tfile").trigger('click'); + $("input.file").trigger('click'); }); } @@ -97,6 +97,22 @@ function setDropdownButtonText(text, dropdownButton) { dropdownTextSpan.innerHTML = text } +function validateForm() { + valid = true + file = document.querySelectorAll("input.file")[0] + category = document.querySelectorAll("input.category")[0] + subcategory = document.querySelectorAll("input.subcategory")[0] + torrentname = document.querySelectorAll("input.name")[0] + description = document.querySelectorAll("textarea.description")[0] + if(file.value.length <= 0) { valid = false } + if(category.value.length <= 0) { valid = false } + if(subcategory.value.length <= 0) { valid = false } + if(torrentname.value.length <= 0) { valid = false } + if(description.value.length <= 0) { valid = false } + + return false; +} + function chunk(string, n) { var ret = ""; for(var i=0, len=string.length; i < len; i += n) { diff --git a/templates/create.html b/templates/create.html index 0859cfc..bac269b 100644 --- a/templates/create.html +++ b/templates/create.html @@ -18,13 +18,13 @@ vim: ts=2 noexpandtab {% endfor %} {% endif %} -