1
0
-1

Does anyone have any ideas on how to remove attachments from the form by using script/rules instead of manually clicking on the trash button?

Thanks

Sindy

    CommentAdd your comment...

    1 answer

    1.  
      1
      0
      -1

      First, you need to find the $scope for the Attachments Field.

      This is done with a jQuery query - note how we search by class, which is the string "id-" prepended on the Maestro field ID. There are ways to break this, and other ways to do this, both left as exercises for the reader.

      Then you can call the removeAttachment() function that is defined on the $scope.  Pass in the item from the $fileQueue you want to remove.

      For example, if you named your Attachment Field Component "attachmentField" you can remove the first attachment this way:

      $(".id-attachmentField").scope().removeAttachment(Form.data.attachmentField.$fileQueue[0]);

        CommentAdd your comment...