Comment Validation

I’d like to add a feature which validates comment submissions in a Ticket’s history. The validation would occur on submit, preventing submission until the comment is valid (correct paragraph prefix or suffix).

My default assumption is to make this a Javascript challenge, and maybe use the CKEditor methods for grabbing that data… keeping all logic on the front end. But, it might make more sense to grab it after submission.

Is there a precedent for something like that? Can someone point me in the right direction or share a similar experience?

I’ve done something similar as a prototype for service requests (for example provisioning a new server or getting an SSL certificate). Not in live service yet, but it seems to work.

What I did for those was create a new local page for each request type under /opt/rt4/local/html/SelfService with the RT header/footer/brand/theme and then in there have a form with Javascript pre-submission validation. Using Javascript (well jQuery actually) means that we can also have fields appear/disappear depending on the choices in other parts of the form (so there’s no point in asking if SQLServer needs to be installed on a new server if the OS is Linux for example). We can also provide tooltip help and do stuff with embedded Perl in the page (such as checking if the requesting user is in a group that allows them access to some request attributes that other folk can’t normally see).

Once the validation was correct, the validated form fields were marshalled up as a block of text and submitted as the initial ticket content. I guess we could have used RT CustomFields, but as every request is different, this seemed simpler and was preferred by the team that will be getting the tickets appear in their queue. Each request form is a bit different due to different requirements, but once each is written they should rarely need to be touched - the tickets they generate are just normal RT tickets in the standard workflow.

That’s helpful, because you sparked an idea for something else I can implement :slightly_smiling_face:

In this instance, I think I need to modify Update.html when making a comment/reply in the transaction history such that the submit button is disabled until validation is good to go.