Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

How to force user to upload specific number of attachments?

Avatar

Level 1

I have a form where users select checkboxes to attach a document.  I need to script that will compare the number of checkboxs selected with the number of attachments, and pop up an error message if these aren't the same.

Suggestions?

Thanks!

1 Reply

Avatar

Level 10

Hi,

Maybe something along the lines of;


var selectedCheckboxesCount = Subform1.resolveNodes('#field.[ui.oneOfChild.className == "checkButton" and $ == 1]').length;


var attachmentCount = event.target.dataObjects == null ? 0 : event.target.dataObjects.length;


if (selectedCheckboxesCount != attachmentCount)


{


app.alert("Something is missing")


}


Line 1 assumes all your checkboxes are in a subform called Subform1 and that they have the default value for true (which is 1), you may need to change these two things.

Regards

Bruce