top of page
Delete Data in a Collection
ATTENTION: THIS IS OUR OLD SITE. TO SEE OUR NEW WEBSITE, CLICK HERE.
Learn how to delete data in a single collection using code. Sometimes there is a need to delete all or specific the data in a single collection, and it is too time consuming to do so manually one row at a time.
This example sets up a dropdown selector (#iptDeleteFrom) for choosing which collection you'd like to delete the data from, and a delete button (#iptDeleteData) to trigger the deletion process. There is a also a text (#txtDeleteMsg) to display whether the deletion was successful or not. The #iptDeleteFrom selector is manually populated with the collections available for data deletion - the value of each choice needs to match the corresponding collection exactly, including upper and lower case letters. The delete button requires an on click event. The permissions on your collection require that anyone can delete from them.
The code to delete ALL DATA in a collection when the #iptDeleteData button is clicked is found below.
The code to delete SPECIFIC DATA in a collection when the #iptDeleteData button is clicked is found below. This example shows how to delete rows in a collection based on a specific email address i.e. contact@WixCodeBank.com. You could include custom input fields to select or specify which entries to delete.
Please login or sign-up (it's free!) to view our code. Refresh the page if already logged in.
Disclaimer: To the best of our knowledge, this code works for its stipulated purpose. If you find an error in our code, or know of a better way to achieve the same result - please contact us! We will help where we can, however please be aware that the code is provided 'as is' and without a promise of support in using or implementing it.
bottom of page