Using Rules Editor to limit number of attachments | Community
Skip to main content
Level 3
Apr 15, 2021 6:09 PM UTC
Solved

Using Rules Editor to limit number of attachments

I recently noticed that you can either select one or multiple attachments for an adaptive form. I would l ike to limit the number of attachments to 4. How can I do that?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Mayank_Tiwari
Mayank_TiwariAccepted solution
Employee
Oct 6, 2021 8:27 AM UTC

Simply use the following script in the validate event of the file attachment field. it works.

 

if(this.value.split("\n").length < 5)
  {
    true;
  }
else
  {false;}

 

 

3 replies

Mayank_Tiwari
Mayank_TiwariAccepted solution
Employee
Oct 6, 2021 8:27 AM UTC

Simply use the following script in the validate event of the file attachment field. it works.

 

if(this.value.split("\n").length < 5)
  {
    true;
  }
else
  {false;}

 

 

Translate
Mayank_Gandhi
Employee
Apr 27, 2021 6:54 AM UTC

@lsmurph use this on value commit of attachment: 

guideBridge.getFileAttachmentsInfo({
success:function(list) {
for(var i = 0; i< list.length; i++) {
// console.log(list[i].name + " "+ list[i].path);
if(list.length>4)
document.getElementsByClassName('button-default button-medium guide-fu-attach-button')[0].disabled=true;
}
}
});

Translate
Mayank_Gandhi
Employee
Apr 23, 2021 7:39 PM UTC

@lsmurph Can be handled but may require custom code. Let me see if I have one in the archive.

Translate