Related item, limit number of files in drag drop
Hi,
I have a related item form, and I'd like to limit the number of files that can be dragged and uploaded at one time.
For example, limit to 10 files at a time, if the user tries to drag 15, it will stop the upload and show a message about the limit?
Thanks.
I have a related item form, and I'd like to limit the number of files that can be dragged and uploaded at one time.
For example, limit to 10 files at a time, if the user tries to drag 15, it will stop the upload and show a message about the limit?
Thanks.
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
Hi,
You can check the number of rows in the Related Items with JavaScript:
If it exceeds a limit, notify a user by alerting or displaying a notice somewhere in the form.
You can check the number of rows in the Related Items with JavaScript:
Code: Select all
fd.relatedItems(0).data('ctx').ListData.Row.length
Thanks Dimitry,
I don't want to set a limit on the related items list. I want to set the number of files limit to 10 at each time.
I want to set a limit because I am using the fd.updateDroppedDocuments function to update some data to the related item. I will have users who like to drag 80 files at a time, and not all of the related will get updated with the proper data only the first few.
Is there a way to make sure all of the files will have the proper data updated?
thanks.
I don't want to set a limit on the related items list. I want to set the number of files limit to 10 at each time.
I want to set a limit because I am using the fd.updateDroppedDocuments function to update some data to the related item. I will have users who like to drag 80 files at a time, and not all of the related will get updated with the proper data only the first few.
Is there a way to make sure all of the files will have the proper data updated?
thanks.
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
Right, you can check the number of already uploaded documents and notify a user that he cannot upload more. To check the number of docs on the client side, use the code:
fd.relatedItems(0).data('ctx').ListData.Row.length
fd.relatedItems(0).data('ctx').ListData.Row.length
Hi Dimitry,
This will not work if there are already 10 files in the relateditem list. I want to let the user to keep uploading to the list but only max 10 items at a time.
Is there a way to check how many files there are in the 'drop' action, before the upload begins?
This will not work if there are already 10 files in the relateditem list. I want to let the user to keep uploading to the list but only max 10 items at a time.
Is there a way to check how many files there are in the 'drop' action, before the upload begins?
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
Aha, now I see. User cannot attach more than 10 docs at a time. The easiest solution is adding a notice onto the form: please, upload no more than 10 documents. Checking the number of dropped docs will require a deep research of the SharePoint grid and its events. I'm afraid it will take about 3 support hours.
-
- Information
-
Who is online
Users browsing this forum: No registered users and 19 guests