RT FormTools Multiple Text Questions

Hi,

We recently installed RT::Extension::FormTools. I’m trying to create a form. A bunch of forms I’d like to create are question then fill-in-the-blank. I don’t have custom fields for these as that didn’t seem to fit. I’d really just like the questions and answers to go in to the ticket content.

Here’s an example form:
Subject: Request Service Account
Purpose:
Department:
Account Number:

I can do this pretty easily in HTML, but if I try to use the HTML element in the formtools gui, that doesn’t seem to get added to the content of the ticket. Any thoughts about how I might be able to do this?

Current solution is using a content box that’s prefilled with all of my questions but users would then be able to edit my prefilled questions as well.

I wonder if you make your custom HTML have an ID value of Content if that would just ‘work’

Edit* Testing that it doesn’t seem to just work sadly

If you’re feeling wild, you could do something like this haha:

<div class="formtools-item">
    <label>Name: <input type="text" id="name"></label>
    <label>Email: <input type="email" id="email"></label>
    <label>Age: <input type="number" id="age"></label>

    <!-- Hidden input to store merged data -->
    <input type="hidden" name="Content" id="Content">
</div>

<script>
    document.addEventListener("DOMContentLoaded", function () {
        // Function to update the hidden input field
        function updateContent() {
            const data = {
                name: document.getElementById("name").value,
                email: document.getElementById("email").value,
                age: document.getElementById("age").value
            };

            document.getElementById("Content").value = JSON.stringify(data);
            console.log("Updated Content:", document.getElementById("Content").value);
        }

        // Get all input fields
        const inputs = document.querySelectorAll("#name, #email, #age");

        // Add event listeners to update Content on change
        inputs.forEach(input => {
            input.addEventListener("input", updateContent);
        });

        // Initialize the Content field on page load
        updateContent();
    });
</script>

As a HTML section

1 Like

I was thinking something like that, but I was REALLY hoping I wouldn’t have to go that crazy with it. I think I may have figured out a way to do it but using custom fields.

Hi, @brandonbiggs .

I’ve changed the way I’m handling forms with this extension. Some colleagues asked me to make forms with some fields the users need to feed but they doesn’t need them to be CF. Solution I’ve applied:

  1. Create the queue “Forms”. With all the CF needed for any form we use.
  2. Create the CF “Queue”. With the name of the queues that use Forms.
  3. Create the Form based in the Queue “Forms”.
  4. Add the CF “Queue” as hidden setting the destination queue as a default value.
  5. Configure all other fields to be added in the content field.
  6. Route the form to the destination queue depending on the value of the CF “Queue”.

You can leave some CF out of the Content field if they are in the destination Queue.

It’s an other point of view.