I am trying to manage comments on a post this way.
When the user request a post page the page is displayed as follow:
All comments are displayed inside Pjax begin and end. Comments by the current user are added a request edit (value edit) button.
When the user clicks the request edit button, the id of the comment is passed in the post and the controller send this information back to the comment in order to display an edit form – text area and submit button (value update)– instead of just the request-edit button when the list of comments is refreshed in consequence to the ajax request. Thus the user can change the comment’s content. This works fine and the user can edit, and re-edit the comment indefinitely.
Below the list of existing comment, a form – text area and submit button (value create )— is added to allow the user create a new comment. I would like the user being able to create as many comments he wants, even after he has modified previous comments.
In my controller, I use the value of the button to distinguish the situation:
edit : the user wants an existing comment’s edition
update : the user submits a modified existing comment
create: the user submits a new comment.
All this is not far from working but I am facing something I cannot solve.
The create comment only works if the create comment button is pressed first. If it used a second time, the Request’s POST doesn’t include the submit button’s value any longer. The same occurs if an existing comment has been updated before.
For detail, please see attachments
Additionnal edit: all what is said above was detected using Firefox. With chromium there are no problems.