The code is definitely not working on hide/disable. It's completely ignored in fact.
Try adding the following to a control. You'll notice that the control remains hidden even after an attachment is uploaded. Time for a code fix, perhaps?
ah, sorry. I haven't immediately realized attachment control is one of those which formatting rules (resp. runtime functions) are not supported for.
I'm just popping in to say that none of these formats worked for me, so I ended up taking the " < 1 " portion and calculating the number in a calculated field, then using that variable in the validation. Works well for my purposes.
Hey Marian Hatala -- can you confirm if this should work in Repeating Section attachments, now that we have this as an option? I've your wonderful code work many times before but now trying it on a repeating section, I just keep returning "0" for attachment count.
I can confirm this answer with the explanation works perfectly on a custom list form. I did take a few minutes to actually test this out on a test site. The original answer's post is technically correct, but it did not provide the required details to achieve the objective where yours did. I was able to figure out how to unmark the other one and I have given the answer to you. Thank you. Sorry it took me nearly a year to do that.
Below is a screenshot of the proof of concept. You can see how I formatted on the right the conditions of the validation. I also had a formatting rule that hides the attachments field when the drop down shows "No". When in that condition, the attachments are not required:
You cannot add attachments into a repeating field. So unfortunately the answer to this is no. I just tested this out using the sample I posted above. I would imagine it works fine if you leave the attachments outside the repeating field if you follow the same guidelines as above.
Hey Tyler Walton -
Are you upgraded all the way? We have had this functionality since around March, I believe -- On-Prem & in Mobile, functionality confirmed & in production.
Rhia Wieclawek, When I was writing the code it was not supposed attachment control will ever be usable within repeating section. so it was not written to consider this at all.
... and I haven't investigated (yet) what would need to be changed to make it working.
but looking on how selectors are applied within the code it cannot work for multiple attachment controls with the same class.