Clearing the Attachments SharePoint Field

Hi,

I'm using an Attachments field on a SharePoint form and it's not clearing. I can upload attachments but after I submit the form and it does fd.clear() the attachment field still has the old attachments in it:

I attach things:

I Submit it:

But when I get back to the place to attach things the attachments from last submission are still there:

What do I need to run to clear the attachments. I have tried a few things and none of them work like:
Attachments.value = null;

Hello @NG-Helpdesk,

Are you using the SharePoint attachment field? Or is it a common Attachment field?

fd.clear() remove field values, including attachments.

Do you have any custom code on your form? Please try to comment it out, clear browser cache and check if you see teh same behaviour of the attachment field.

Hi @mnikitina,

Thanks for getting back to me. It's the SharePoint Attachment field.

I have tried what you have said. I have cleared my cache and tried again, the same thing happened. I have added a button that just does fd.clear(); with no custom code and this clears attachments if the items have NOT been submitted but if they have been submitted the fd.clear(); button does the same thing and the last lot of items that were uploaded are still there.

I have asked another user to check if the same behaviour happens for them and it does.

I do have custom code. The Submit button does the following:

window.SaveMe = function() {
    fd.save();
    fd.spSaved(function(result) {
        ResetForm();
    });   
} 

The ResetForm(); calls this:

window.ResetForm = function() {
  //name of function - window. is needed to allow the call in the button click to access this
  ClearVariables(); 
  //calls ClearVariables function
  ShowHideControls(); 
  //calls ShowHideControls function
  SetInstructionsBox(); 
  //calls SetInstructionsBox function
  fd.clear(); 
  //runs the clear form function
}

Which calls other functions that reset all my variables and re-hides any controls and then does fd.clear();. The reason I did this was that fd.clear(); was not resetting everything to the load state again.

Hello @NG-Helpdesk,

Do you want to keep the New form open and clear it after submitting a form?
If so, you can redirect user to a new form using the example from this article.

If that is not what you want, please provide more details about the form so I could reproduce the form behavior on my side. You can export form and share it with me.
image

Hi @mnikitina,

Thanks for this. That IS what I want and I have implemented your link but it still does the same thing. Any uploaded attachments are still there when I go there again.

I will private message you with the exported form and details.

Thanks very much for all your help.

Hello @NG-Helpdesk,

Thank you for the form. I couldn't reproduce the issue on my side.

Do you see the same attachment field behavior in other lists? To confirm that it is related to forms, please try re-creating the issue in other lists. Create a new list from scratch, design the new form, and check if the attachment field is cleared or not.