64
Views
2
Comments
Upload File - How To Prevent Page Refresh on File Upload

Hello Everyone,


I have a modal that collects information about a user and then asks the user to upload a file.

The issue that I am having is, when the file is uploaded, the modal closes and then page refreshes.

I have an Iframe behind the modal, so by refreshing the page, all my progress on the Iframe is lost and reset. 

I found out that, on upload, a page refresh is issued. 

Is there any way to prevent this from happening?

i've tried using JS adding an onclick event  for the button, calling a fuction that prevents the default behavior for the action but its not working.

UserImage.jpg
Accelance Partners

Hii @Jorge Figueiredo 

For better understanding can you share OML or Screenshots.

Thanks,

Sonali Verma

2022-07-22 08-49-20
Laura Fidalgo

Hi @Jorge Figueiredo ,

That's normal behavior because you're submitting data to the database. The upload is a submit, and after a submit, the normal behavior is a refresh.

I'm not sure you'll be able to prevent that, unfortunately 

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.