cancel
Showing results for 
Search instead for 
Did you mean: 

[MDK] How to clear files attached to attachment component inside a form cell?

miqueias_maia
Participant
0 Kudos

Hey experts.

I have a JS rule to clear a form when the user clicks on erase button. The expected behavior is clear all form inputs, including attachments component.

To listpickers, simple property, switches and notes, we're setting the values as null, empty string, false and empty string, respectly, using setValue method and it works good.

To attachment component, we've tryed a lot of values, as those I've mentioned and, obviosly, a empty array (since the documentation defines the value as array of objects). Nothing works and we catch a error that says that attachment component hasn't setValue method.

Could you help me teching how to reset or set a empty value to attachments component inside a form cell?

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos

What version of MDK are you using and what platform are you working on (iOS, Android, Web, Multiple)?

miqueias_maia
Participant
0 Kudos

Hello bill.froelich!

We are using the latest version and our application is running on iOS and Android.

Accepted Solutions (1)

Accepted Solutions (1)

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos

miqueias.maia MDK 6.2.5 has been released and contains a fix for the clearing of the attachments issue you describe. It is available for download from the SAP Marketplace now.

Answers (1)

Answers (1)

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos

Clearing the list of attachments is just like clearing other fields. Call setValue([]) and pass it an empty array.

However, there does appear to be a bug with the attachment control in 6.2.2 where the UI is not properly redrawn to "clear" the display of the existing attachments. The control however does not contain any attachments, even though the display is showing attachments present. If you call getValue on the control after clearing the attachments it will not return anything.

I will open an internal bug for this issue so we can look at fixing it.