Using Rules Editor to limit number of attachments | Community
Skip to main content
New Participant
April 15, 2021
Solved

Using Rules Editor to limit number of attachments

  • April 15, 2021
  • 3 replies
  • 905 views

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.
Best answer by Mayank_Tiwari

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
October 6, 2021

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;}

 

 

Mayank_Gandhi
Employee
April 27, 2021

@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;
}
}
});

Mayank_Gandhi
Employee
April 23, 2021

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