0

I'm creating a simple ticketing system in Drupal 8 to log my daily tasks. The content type contains title, body, and ticket status. The status field can be new, in progress, or completed. When I create a new ticket, the status is set as new by default. I also have commenting enabled on this content type.

The issue I'm having now is the UX of this setup. I can comment on the ticket fine, but if I were to change the status of the ticket to in progress or completed, I'd have to goto the edit page of the node and make this change. How can I change the status value without going to the edit page? Is there a ajax field update feature?

I wan't to be able to make my comment and also change the status of the ticket all at once vs making a comment, then click edit to change the status.

2 Answers 2

2

You could build an ajax form that would update the node's "Ticket Status" field, embed that in a custom block and place that block on the page for that node or embed it in the node. Instead of in a block, you could also create a field formatter plugin that embeds the ajax form into the display for that field.

1
  • any example code I can follow to get this done? thanks. Commented May 25, 2017 at 19:45
0

There a thousands of ways you can place a minified node edit form, see your last question Creating a ticket system with core only. How to modify fields on full_content view without reloading? or the great answer from @oknate Creating a ticketing system in Drupal 8. How to change a node's field value without going to the edit page?

But what is new in this question is, that you want to do this together with the comment form. The comment form has already a submit that posts data to drupal. Then you don't need a second form. You could extend the comment form in a form alter hook with two submit buttons, which each execute not only the default submit from the comment form, but also a custom submit which changes the status of the parent node either to progress or completed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.