why dropzon inactive <form id="my-form" method="POST"> <select id="targetlanglist"…
- User
why dropzon inactive {% for key, value in languages.items() %} {{ value }} {% endfor %} Submit
- Assistant
It's difficult to know for sure without more context, but it's possible that the "Dropzone" library is inactive because it's not being used on the page correctly or not being loaded properly. Another possibility could be that the developer intentionally disabled it for some reason.
- User
can you see some issues in this code
- Assistant
There are a few issues with the code:
-
The selector for the
document.readyfunction is missing the$sign. It should be$(document).ready(function() {... -
The double quotes in the
dictCancelUploadanddictUploadCanceleddictionary properties are not straight quotes but curly quotes. This might cause errors. -
The
initfunction inside the dropzone initialization code has curly quotes around the"success"event, which might cause issues. -
The ajax call inside the form submission is missing the '' sign before `.ajax({`. It should be `.ajax({`
Other than these issues, the code looks good and should function properly if the referenced libraries and files are included correctly.
-
- User
in clause for could you write how it has to be
- Assistant
Sure, here's an example of how to use the
INclause in SQL:SELECT column_name(s) FROM table_name WHERE column_name IN (value1, value2, ...);In the
WHEREclause, you can specify theINkeyword followed by a set of values you want to match against the specified column. The values should be separated by commas and enclosed in parentheses.For example, if you have a table named
Customerswith a columnCountry, and you want to select all customers from either the United States or Canada, you can use theINclause like this:SELECT * FROM Customers WHERE Country IN ('USA', 'Canada');This will return all rows from the
Customerstable where theCountrycolumn has a value of either 'USA' or 'Canada'. - User
- Assistant
Here is a corrected version of the code with the issues addressed:
<script> Dropzone.autoDiscover = false; $(document).ready(function() { // Initialize the dropzone element $("#my-dropzone").dropzone({ url: "/localization/multi-local-from-file", addRemoveLinks: true, paramName: "data", maxFiles: 1, maxFilesize: 3, // Maximum filesize in MB acceptedFiles: ".arb", dictDefaultMessage: "Drag and drop an ARB file here or click to select one", dictFallbackMessage: "Your browser does not support drag and drop file uploads.", dictInvalidFileType: "Only ARB files are allowed.", dictFileTooBig: "The file is too big. Maximum allowed size is 3 Mb.", dictResponseError: "Server responded with {{statusCode}} code.", dictCancelUpload: "Cancel upload", dictUploadCanceled: "Upload canceled.", dictCancelUploadConfirmation: "Are you sure you want to cancel this upload?", dictRemoveFile: "Remove file", dictMaxFilesExceeded: "You can’t upload any more files.", init: function() { var dz = this; // On successful translation, enable the download button and change the download link dz.on("success", function(file, response) { $("#download-multiple").prop("href", URL.createObjectURL(response)); $("#download-multiple").prop("disabled", false); }); } }); // Set selected target language(s) on form submission $("#my-form").submit(function(event) { event.preventDefault(); var formData = new FormData(event.target); $.ajax({ url: "/localization/multi-local-from-file", method: "POST", data: formData, processData: false, contentType: false, success: function(response) { // handle success response }, error: function(xhr, status, error) { // handle error response } }); }); }); </script>Changes made:
- Add a
$to each element selection syntax e.g.$("#my-dropzone") - Changed
("Upload canceled.")to("Upload canceled.") - Fixed the
dictFileTooBigmessage - Added the
$before the$.ajaxmethod call.
- Add a
- User
drop me it ones again
- Assistant
Sure, here's the corrected code again:
<script> Dropzone.autoDiscover = false; $(document).ready(function() { // Initialize the dropzone element $("#my-dropzone").dropzone({ url: "/localization/multi-local-from-file", addRemoveLinks: true, paramName: "data", maxFiles: 1, maxFilesize: 3, // Maximum filesize in MB acceptedFiles: ".arb", dictDefaultMessage: "Drag and drop an ARB file here or click to select one", dictFallbackMessage: "Your browser does not support drag and drop file uploads.", dictInvalidFileType: "Only ARB files are allowed.", dictFileTooBig: "The file is too big. Maximum allowed size is 3 Mb.", dictResponseError: "Server responded with {{statusCode}} code.", dictCancelUpload: "Cancel upload", dictUploadCanceled: "Upload canceled.", dictCancelUploadConfirmation: "Are you sure you want to cancel this upload?", dictRemoveFile: "Remove file", dictMaxFilesExceeded: "You can’t upload any more files.", init: function() { var dz = this; // On successful translation, enable the download button and change the download link dz.on("success", function(file, response) { $("#download-multiple").prop("href", URL.createObjectURL(response)); $("#download-multiple").prop("disabled", false); }); } }); // Set selected target language(s) on form submission $("#my-form").submit(function(event) { event.preventDefault(); var formData = new FormData(event.target); $.ajax({ url: "/localization/multi-local-from-file", method: "POST", data: formData, processData: false, contentType: false, success: function(response) { // handle success response }, error: function(xhr, status, error) { // handle error response } }); }); }); </script>I hope it helps!
- User
Dropzone.autoDiscover = false; $(document).ready(function() { // Initialize the dropzone element ("#my-dropzone").dropzone({ url: "/localization/multi-local-from-file", addRemoveLinks: true, paramName: "data", maxFiles: 1, maxFilesize: 3, // Maximum filesize in MB acceptedFiles: ".arb", dictDefaultMessage: "Drag and drop an ARB file here or click to select one", dictFallbackMessage: "Your browser does not support drag and drop file uploads.", dictInvalidFileType: "Only ARB files are allowed.", dictFileTooBig: "The file is too big 3 Mb. Maximum allowed size: 3 Mb.", dictResponseError: "Server responded with {{statusCode}} code.", dictCancelUpload: "Cancel upload", dictUploadCanceled: "Upload canceled.", dictCancelUploadConfirmation: "Are you sure you want to cancel this upload?", dictRemoveFile: "Remove file", dictMaxFilesExceeded: "You can’t upload any more files.",
init: function() { var dz = this;
// On successful translation, enable the download button and change the download link dz.on("success", function(file, response) { ("#download-multiple").prop("href", URL.createObjectURL(response)); ("#download-multiple").prop("disabled", false); }); } });
// Set selected target language(s) on form submission ("#my-form").submit(function(event) { event.preventDefault(); var formData = new FormData(event.target); .ajax({ url: "/localization/multi-local-from-file", method: "POST", data: formData, processData: false, contentType: false, success: function(response) { // handle success response }, error: function(xhr, status, error) { // handle error response } }); }); }); is it correct
- Assistant
The code you posted looks similar to the corrected code I provided earlier. The only difference is that the
$sign is missing before the parentheses for the selector. It should be$("#my-dropzone")instead of("#my-dropzone")Here's the corrected code with the
$sign added before the parentheses for the selector:<script> Dropzone.autoDiscover = false; $(document).ready(function() { // Initialize the dropzone element $("#my-dropzone").dropzone({ url: "/localization/multi-local-from-file", addRemoveLinks: true, paramName: "data", maxFiles: 1, maxFilesize: 3, // Maximum filesize in MB acceptedFiles: ".arb", dictDefaultMessage: "Drag and drop an ARB file here or click to select one", dictFallbackMessage: "Your browser does not support drag and drop file uploads.", dictInvalidFileType: "Only ARB files are allowed.", dictFileTooBig: "The file is too big 3 Mb. Maximum allowed size: 3 Mb.", dictResponseError: "Server responded with {{statusCode}} code.", dictCancelUpload: "Cancel upload", dictUploadCanceled: "Upload canceled.", dictCancelUploadConfirmation: "Are you sure you want to cancel this upload?", dictRemoveFile: "Remove file", dictMaxFilesExceeded: "You can’t upload any more files.", init: function() { var dz = this; // On successful translation, enable the download button and change the download link dz.on("success", function(file, response) { $("#download-multiple").prop("href", URL.createObjectURL(response)); $("#download-multiple").prop("disabled", false); }); } }); // Set selected target language(s) on form submission $("#my-form").submit(function(event) { event.preventDefault(); var formData = new FormData(event.target); $.ajax({ url: "/localization/multi-local-from-file", method: "POST", data: formData, processData: false, contentType: false, success: function(response) { // handle success response }, error: function(xhr, status, error) { // handle error response } }); }); }); </script>I hope it helps!
- User
Dropzone.autoDiscover = false; (document).ready(function() { // Initialize the dropzone element ("#my-dropzone").dropzone({ url: "/localization/multi-local-from-file", addRemoveLinks: true, paramName: "data", maxFiles: 1, maxFilesize: 3, // Maximum filesize in MB acceptedFiles: ".arb", dictDefaultMessage: "Drag and drop an ARB file here or click to select one", dictFallbackMessage: "Your browser does not support drag and drop file uploads.", dictInvalidFileType: "Only ARB files are allowed.", dictFileTooBig: "The file is too big 3 Mb. Maximum allowed size: 3 Mb.", dictResponseError: "Server responded with {{statusCode}} code.", dictCancelUpload: "Cancel upload", dictUploadCanceled: "Upload canceled.", dictCancelUploadConfirmation: "Are you sure you want to cancel this upload?", dictRemoveFile: "Remove file", dictMaxFilesExceeded: "You can’t upload any more files.",
init: function() { var dz = this;
// On successful translation, enable the download button and change the download link dz.on("success", function(file, response) { ("#download-multiple").prop("href", URL.createObjectURL(response)); ("#download-multiple").prop("disabled", false); }); } });
// Set selected target language(s) on form submission ("#my-form").submit(function(event) { event.preventDefault(); var formData = new FormData(event.target); .ajax({ url: "/localization/multi-local-from-file", method: "POST", data: formData, processData: false, contentType: false, success: function(response) { // handle success response }, error: function(xhr, status, error) { // handle error response } }); }); }); now it's ok?
- Assistant
Yes, the code you posted now looks correct. All the issues I previously mentioned have been addressed.
This code should work just fine as long as the necessary libraries and files are included and the server-side URL (
/localization/multi-local-from-file) is correct.I hope it works well for you!