Validate number of attachments being uploaded

Feature Request: Validate number of attachments being uploaded

  • Right now, we can validate generic file types (doc vs image vs audio etc) which is really helpful. Happy to see this recent addition.
  • However, our biggest need with attachments is to limit upload by number of attachments. There are various forms I’ve built that really are just looking for one specific upload per attachment field, and external users can break that expectation whenever they want. Using help text to tell them not to do that is merely a visual preventive but not a real technical solution/safeguard.
  • Operators could include Attachments count is equal to / less than / greater than / is between.

Workaround

  • In case its helpful for anyone, I currently have a sort of workaround that allows me to hide an Attachments field when there are the “right” amount of attachments inside of it. I use an Airtable formula field that counts the number of files in the field (thank you, internet!):

IF({Attachments}=BLANK(), 0,LEN({Attachments})-LEN(SUBSTITUTE({Attachments},",",""))+1)

  • This formula will output the number of attachments currently in your field, which can then be used in conditional visibility logic in Noloco.
  • However, this only works retrospectively. For example, let’s say I only allow 2 files to be in a particular field. So the Noloco logic would be, “hide this attachments field when the formula field above = 2.”
  • That’s great for preventing subsequent uploads when there are already two files in the field, however that won’t stop a user from uploading say, 15 files, the first time around.

So ultimately the solution here is to have native validation that checks the number of files being uploaded.

2 Likes