I'm not sure if I'm just form building impaired or not thinking about this the right way. I'm attempting to build a form similar to Gmail's 'compose' form that has an AJAX image uploader. I have a portion of code that uploads the image and returns an image ID working fine. Once I receive the image ID back I've tried appending it to my form in a hidden checkbox field. I want to allow users to upload multiple images, and I'd also like to keep all my hidden checkboxes the same name so I can easily iterate over the values. Essentially this:
Client side (this is from Gmail but on mine these will be hidden):
<input type="checkbox" checked="" value="125e6e5e7d8a2601_125e6e5e7d8a2601_0.2_-1" name="attach" id=":4s"/>
<input type="checkbox" checked="" value="125e6e5e7d8a2601_125e6e5e7d8a2601_0.1_-1" name="attach" id=":50"/>
Server side:
for picture_id in request.POST["attach"]:
#do stuff here with the picture_id
Unfortunately I only receive one of the picture_ids and request.POST["attach"] iterates over it like a string. I'm not sure how to resolve my issue and send all the image IDs without using something like a form <select>
where multiple items can be selected because I'd have to manually add items and select them.
Hopefully this explanation is clear, I'm sure I'm just missing something trivial. Thanks for the help in advance!