Nesting dropzone in existing form?
See original GitHub issueI have a form for posting blog entries. I want to be able to submit multiple fields at once. Instead of designating the class of the form as ‘dropzone’ is it possible to be able to have a dropzone div nested in my current form so one button will submit all my fields, including multiple image upload, at once? Something like this stackoverflow question, but with flask-dropzone. Thanx in advance for any assistance!
My form:
<!DOCTYPE HTML>
<form action="{{ url_for('add_post') }}" method="post" class="add-post" enctype="multipart/form-data">
<dl>
<dt>Post title:
<dd><input type="text" size="30" name="title" spellcheck="true" required>
<dt>Post date:
<dd><input type="date" name="post_date" required>
<dt>Post description(one sentence):
<dd><textarea name="description" rows="3" cols="40" spellcheck="true" required></textarea>
<dt>Post html file:
<dd><input type="file" name="html_file" required>
<dt>Post image(s) file:</dt>
<!--Can something like this be done?-->
<div class="dropzone" id="myDropzone">
{{ dropzone.create(action=url_for('show_posts')) }}
</div>
<dd><input type="submit" value="Submit">
</dl>
</form>
Issue Analytics
- State:
- Created 5 years ago
- Comments:24 (11 by maintainers)
Top Results From Across the Web
Nesting dropzone in existing form? · Issue #14 - GitHub
I have a form for posting blog entries. I want to be able to submit multiple fields at once. Instead of designating the...
Read more >Integrating Dropzone.js into a html form with other form fields
The class of your form is "dropzone" and that is why the form becomes a dropzone. Only use the "dropzone" class on the...
Read more >Building Complex Nested Drag and Drop User Interfaces With ...
In our drawing sample, every draggable item has a drop zone before and after it (via the light blue shading). Each drag source...
Read more >Integrating Dropzone.js into existing HTML form with other ...
Integrating Dropzone.js into existing HTML form with other fields in laravel (2020) #Part-2.
Read more >Adding drop zones to a component | Acquia Cohesion Docs
Within the Elements list, drag the Component drop zone onto your Component layout where you want the editor to be able to drop...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
My take was similiar to @Permafacture
I was considering generating a random UUID.
The images would upload instantly to a ‘/temp/string:UUID’ folder using handle_images_uploads().
The form would submit with UUID to handle_form() and check if there were any images added to the folder.
If my understanding’s correct though - I don’t seem to be able to send the CSRF token twice. So it adds vulnerability to the app.
I’ve created a pull request addressing
#3
and partially#2
.#3
really just needed the example updated, using the csrf token, though if you are fine with using a real CSRF token in that example then I’d add hashing the token rather than using the token to make the path directly. Completing#2
would require an example of updating the init function with a callback. I might do that if we end up needing that functionality for our project.ps. not sure how link the the PR. haven’t done this on github before
pps.
iteritems
doesn’t make a list but it does make a generator object, so it’s still constructing a new python object. It’s not free.items
builds the list in C code which is really fast. Especially for dictionaries with only dozens of elements, it’s not clear to me which would be faster, and both would be so fast that doing anything with each element would dwarf the time it takes to make the list or generator. And network io would be orders of magnitude more. So, I disagree thatiteritems
improves performance here.