Problems, need help? Have a tip or advice? Post it here.
5 posts Page 1 of 1
Hi all,
I am implementing a remove button from the list view of my site, where the user can click and it removes the particular article from a cloned list. I am using the code below to delete the div with article, but when I click the remove button at any point, it only deletes the most recent article and not the particular one I need out of the list. Secondly, I would like the user's list to reflect their cleaned out list even after they logout and log back in. Please help.



<div id="some">


<script>
function myFunction() {
var child = document.getElementById("some");
child.parentNode.removeChild(child);
}
</script>
Hi Brian. Frontend solutions (JS script) must send request to server. Only server script can delete anything from database. Proper tag to delete something from db is cms:db_delete. Somehow you must be able to pass what page id you want to delete to that tag in the following fashion -
Code: Select all
<cms:db_delete masterpage=masterpage page_id=k_page_id />
Thanks for the quick feedback @trendoman ... just curious won't db_delete completely remove the article. What I am trying to achieve is to have users hide/remove articles they dont want on their home list, without compeletly deleting it for everyone else.
You are welcome. Hiding means keeping in database, of course. What you can do is either use frontend JS script that saves article status in browser cookie - this does not involve Couch at all.

Alternative approach is to have status persisted to database permanently. There are various ways of achieving this. No matter which way, status update must be passed to backend in this case.
Much appreciated trendoman, let me try both options, see which would be easier for me to implement. Have a great day!
5 posts Page 1 of 1