Related item, limit number of files in drag drop

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
metrovan
Posts: 16
Joined: Fri Feb 10, 2017

07 Apr 2017

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.

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

10 Apr 2017

Hi,
You can check the number of rows in the Related Items with JavaScript:

Code: Select all

fd.relatedItems(0).data('ctx').ListData.Row.length
If it exceeds a limit, notify a user by alerting or displaying a notice somewhere in the form.

metrovan
Posts: 16
Joined: Fri Feb 10, 2017

10 Apr 2017

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.

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

11 Apr 2017

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

metrovan
Posts: 16
Joined: Fri Feb 10, 2017

11 Apr 2017

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?

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

12 Apr 2017

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.

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 19 guests