diff --git a/views.py b/views.py
index b0524eea1a71cc1acd26f1a73367102525c1b680_dmlld3MucHk=..e4db834f9a38f24fb71895d88d0ba0b034164d17_dmlld3MucHk= 100644
--- a/views.py
+++ b/views.py
@@ -218,11 +218,6 @@
 
     def comment_form(self, commented, newcomment=None):
         self._cw.add_js(('cubicweb.edition.js', 'cubes.comment.js'))
-        if newcomment is None:
-            newcomment = commented
-            formvalues = {'comments': commented.eid}
-        else:
-            formvalues = {}
         if self._cw.cnx.anonymous_connection:
             self.propose_to_login()
         # hack to avoid tabindex conflicts caused by Ajax requests
@@ -232,9 +227,18 @@
                    fw.Button(stdmsgs.BUTTON_CANCEL,
                              onclick=self.jsfunc % (jseid, 'true'))]
         fvreg = self._cw.vreg['forms']
-        if newcomment is not None and not commented.has_eid():
+        formvalues = {}
+        if newcomment is not None: # creation
+            formvalues['comments'] = commented.eid
+        if newcomment is None or commented.has_eid(): # creation / edition
+            # use formtype=inlined to avoid viewing the relation edition section
+            form = fvreg.select('edition', self._cw, entity=newcomment or commented,
+                                domid='commentForm%s' % commented.eid,
+                                form_buttons=buttons,
+                                formtype='inlined')
+        else: # creation of both commented and comment entities
             form = fvreg.select('composite', self._cw, form_buttons=buttons,
                                 domid='commentForm%s' % commented.eid,
                                 form_renderer_id='default')
             form.add_subform(fvreg.select('edition', self._cw, entity=commented,
                                           mainform=False))
@@ -236,15 +240,8 @@
             form = fvreg.select('composite', self._cw, form_buttons=buttons,
                                 domid='commentForm%s' % commented.eid,
                                 form_renderer_id='default')
             form.add_subform(fvreg.select('edition', self._cw, entity=commented,
                                           mainform=False))
-            cform = fvreg.select('edition', self._cw, entity=newcomment,
-                                          mainform=False)
-            form.add_subform(cform)
-        else:
-            # use formtype=inlined to avoid viewing the relation edition section
-            form = fvreg.select('edition', self._cw, entity=newcomment,
-                                domid='commentForm%s' % commented.eid,
-                                form_buttons=buttons, formtype='inlined')
-            cform = form
+            form.add_subform(fvreg.select('edition', self._cw, entity=newcomment,
+                                 mainform=False))
         self.w(u'<div id="comment%sSlot">%s</div>' % (
@@ -250,5 +247,5 @@
         self.w(u'<div id="comment%sSlot">%s</div>' % (
-            commented.eid, form.render(formvalues={'comments': commented.eid},
+            commented.eid, form.render(formvalues=formvalues,
                                        main_form_title=u'',
                                        display_label=False,
                                        display_relations_form=False)))