LPology / Simple-Ajax-Uploader

Javascript file upload plugin with progress bar support. Works in all major browsers, including IE7+, Chrome, Firefox, Safari, and Opera. No dependencies - use it with or without jQuery.
995 stars 267 forks source link

onSubmit... i want to cancel operation if my checkbox is not checked #147

Closed pascalf22 closed 8 years ago

pascalf22 commented 8 years ago

Hello!

Thanks so much for this plugin!

All work.. except one small thing. I want that before uload image, user must check a checkbox

OnSubmit i have this

if(checkbox is checked) { //..... form submit } else// but if checkox not checked { // i show message error and i inform user to check the checkbox return false; }

This works perfectly.. but the problem is. when user upload image and the checkbox IS NOT checked, the user receive message and the image is not uploaded... but if he check the checkbox and upload a photo... the 2 photos are uploaded.. (the first when he did not check the checkbox) and the second image..

how can i really cancel submit if checkbox is not checked?

Thansk a lot !!

Pascal

pascalf22 commented 8 years ago

Ok i think i found the solution.. it works:

i add this in onSubmit :

uploader.removeCurrent();

Thanks a lot !

LPology commented 8 years ago

That's exactly right. Thanks for updating.