Data-clearable remove button event

I have set my widget data-clearable=“true” and I get the remove button after the upload. When i click the remove button I get the onchange event, but the file parameter is null-- so trying to figure out how to know which file was removed. I am looking for the UIUD. thanks.

Hi @jen,

You can save a UUID of the previously uploaded file to a variable, and when the user clears the widget, you can read the value of this variable to get the UUID of the file

widget.onChange((file) => {
  if (!file) {
    console.log("Widget cleared. File: ", uploadedFileUUID);
  file.done((fileInfo) => {
    uploadedFileUUID = fileInfo.uuid;
    console.log("File uploaded: ", fileInfo.uuid);

Let me know if this helps.

thanks that makes sense.