# Hasmany relation with edit in single form

**URL:** <https://discourse.cakephp.org/t/hasmany-relation-with-edit-in-single-form/1603>\
**Category:** Need Help\
**Created:** [November 24, 2016, 4:53am UTC](https://discourse.cakephp.org/t/hasmany-relation-with-edit-in-single-form/1603 "2016-11-24T04:53:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![thomasg](https://avatars.discourse-cdn.com/v4/letter/t/9d8465/32.png) [@thomasg](https://discourse.cakephp.org/u/thomasg)\
**Post date:** [November 24, 2016, 4:53am UTC](https://discourse.cakephp.org/t/hasmany-relation-with-edit-in-single-form/1603/1 "2016-11-24T04:53:25Z")

</div>

Hi,

I made a form where I can edit entity article and its related HasMany relation with comments in one form.

For example

-\> [Article.name](http://Article.name),

-\> [Comment.1.id](http://Comment.1.id), [Comment.1.name](http://Comment.1.name)  
-\> [Comment.2.id](http://Comment.2.id), [Comment.2.name](http://Comment.2.name)  
-\> [Comment.3.id](http://Comment.3.id), [Comment.3.name](http://Comment.3.name)

When I remove comment 2 from this list (using javascript) and then click save. The comment will still persist in the database. How to make sure the comments not on this list get removed?
