Introducing Experimental Form Templates

This is absolute great way to enforce some behaviour in a particular category (my painpoint was job posting, where everyone posted however they feel like :smiley: )!

A bunch of features extra would be nice:

  • the ability to „switch to no template” (optional). This would be nice to be limited by users, by level, by group etc; Some kind of „trust me bro, I know what I’m doing!”
  • multiple fields on the same row (think first name + last name). A good enough fix would be to allow admins to set a class name for the form template;
  • a repeater (i.e. group a bunch of fields and let users to add more of those);
7 Likes

It would be good to have the ability to:

  • Paste content into an Upload field[1].
  • Add a composer in addition to the textarea, where users have access to the normal suite of features.[2]

  1. The upload functionality in Discourse posts is great. This one’s more difficult to use, requiring images already be saved to disk for example. ↩︎

  2. If I want a user to select a dropdown in addition to a post, with the current approach (a textarea) I dramatically decrease their ability to create their post normally; no pasting images, no edit bar, etc. ↩︎

9 Likes

I tried the form here to report a bug about the theme. Here is my feedback:

  • The form itself is a great idea :+1:
  • No formatting tool is a big miss.
    • Even if markdown syntax is basic, selecting and using the toolbar is often easier/faster. It helps in making a readable message.
    • This can work if the report is a simple but advanced issue; you might need to hide details or insert a table.
  • No inline upload is not convenient.
    • E.g., showing a problem step by step, before/after results, etc.
    • In case of multiple screenshots, you must explain what screenshots you should look at.
  • Same as Thomas, pasting an image would be welcomed. It took me some time to figure out where my screenshots were saved. :smile:
  • Conditional input – when selecting “other,” it would be nice to have an input appearing for that.

Overall, really nice! I’m looking forward to how it will be improved. :slight_smile:

9 Likes

If you have multiple forms enabled for a single category, it isn’t intuitive that there is a dropdown for you to select a form. When you create a new topic, it automatically populates the first form template, which again, if you don’t know what you’re looking at, then you wouldn’t realize there could be other forms.

When you deselect the form, you do see the text “Select form templates” which is clear to me that there is a list of form(s) that I choose from. The composer still shows the form even though one is not selected. This is where I would second, @iamntz about having the option to switch to no template.

6 Likes

Just want to add on to my previous reply and to give a bit more context to our specific use case. We’re looking to implement this in our Site Feedback category. Ideally, we want form templates for things like requesting tags, and keep the default composer (no template option), if the form does not exist or won’t do the job properly.

So, what we’re envisioning would be to create new topic in category and see this:

From there, see “Select form templates”, where from there you can either compose normally or see that form(s) do exist in this category for standardized requests/feedback. :slight_smile:

I can see the argument that some users won’t see or use the form template, if they can compose, but I was trying to stay within the current styling with the placeholder text within the field instead of a label outside of the field. But that’s why it could be an optional feature where the admins enable/disable it. :upside_down_face:

4 Likes

If the selection button was clearly highlighted it would be much easier to encourage users to click it, similar to your Create Topic button

3 Likes

After playing around with the forms more, we discovered a workaround for a “no template” option would be to create a simple “free response” form that can serve as a no template (as seen in the screenshot below).

Adding to this idea, if we didn’t want to change the color to highlight the dropdown, I think adding a down arrow would be a helpful indicator that there is a drop-down selection, just like the categories drop-down.

We discovered that the forms are ordered alphabetically. It would be amazing to have the option to reorder the forms or the option to select the default form that should appear when creating a new topic.

Needless to say, we like what this feature has to offer, and would be excited for such enhancements to it. :slight_smile:

6 Likes

Perhaps I’ve missed it, but is there any way to have a hyperlink in a form? For example, say we had a checkbox for the terms and conditions. In the description it would be useful to have a hyperlink to the actual terms and conditions.

Is this already possible?

Is there also any way to automatically populate the title field when the user creates a new post, such as with their username, or even just some default title?

8 Likes

A post was merged into an existing topic: Setting Form Templates with a tag

I’m trying to build quite a long one to replace a Category Template.

But I’m getting an error that its too big:

However, this setting is set higher:

Is this not the same thing, or is this a bug?

I scanned the code briefly, but couldn’t find the answer.

I feel 5,000 is a little restrictive, can we double it or make it its own setting?

Oh I see now, it’s an Active Record error, and the original migration is here:

3 Likes

I’ve used regular templates for things and while I find the feature more useful than not having a template, the resulting formatting always looks off because it’s not clear how to enter the data.[1] So having a custom form is great!

Feedback:

  1. I really miss having links. (And to a lesser degree, Markdown formatting.) If people don’t know what an option means, it would be handy to point them at the documentation. [I believe this and the next point are addressed by Introducing Experimental Form Templates - #64 by Tris20]
  2. I’d like to have a way to add instructions or an introduction. Ideally with links. :wink:
  3. The title of the post and tags seem to be part of the form. It’s awkward that we can’t customize the prompt. In this form, I’d like the proposed group name to be the title, but it’s not clear how to signal that to users so I added a redundant field:
  4. In the same vein, it’d be interesting to include some way to prompt people to use specific tags. For instance, a support system might use tags to help triage a ticket. The form could include a dropdown with the relevant tags and automatically apply it to the topic. Maybe the same thing with categories too.
  5. It’s not immediately obvious that the multi-select allows more than one choice. You need to know to use Control or Shift to select more than one, from what I can tell.
  6. It’d be neat if checkboxes where represented as checkboxes[2] in the resulting post:

    Is the box checked?

  7. Trying to submit a blank form does nothing and doesn’t show an error. (In fairness, I could add a validation or two to fix this.)

On the whole, this feature really does check a lot of boxes[3] for my purposes. (I’m working on a way for people to propose new groups on my community-building platform.)


  1. The Ask Wizard on Stack Overflow started life as a very crude tamplate. My experience with that colors the way I look at this feature in general. I’ve also used the current Discourse template system for an essay feedback system. ↩︎

  2. At the moment it’s a heading with either “on” if the box is checked. ↩︎

  3. Heh! ↩︎

4 Likes

Oh. I just noticed the form input isn’t saved as a draft. If you close the draft, the topic title is saved, but not anything in a text box or input. Ugh.

1 Like

I got feedback elsewhere and meant to follow up on this, thanks for the nudge :slight_smile:

So to set up ToS checkboxes with links to terms you can do something like

- type: checkbox
  id: read-chatgpt-guidelines
  attributes:
    label: "I have read and I agree to the latest ChatGPT guidelines"
    description: '<a href="https://discourse.company.com/t/current-gpt-and-bing-guidelines/4348"> Click here for the latest ChatGpt Giudelines</a>'
  validations:
    required: true   
- type: checkbox
  id: accept-workspace
  attributes:
    label: "I will not use the @workspace command in customer project if I am using Github Co-pilot"
    description: '<a href="https://discourse.company.com/t/for-compliance-reasons-the-workspace-command-must-not-be-used-in-customer-projects/4371">Click here for details about @workspace command</a>'
  validations:
    required: true        

Which looks like this:

image


This is also the only pain point I have with Forms at the moment. It’s just a bit un-intuitive for users, and being able to auto-populate the title would be very helpful.

5 Likes

Yes this works. The description field might be what I need to serve as introduction/instructions too. Thanks for the tip!

4 Likes

As Tristan said above, it would be very useful to me to be able to populate the topic title from the form responses.

So if we had a form where users could submit their bio and whether they are a dog or a cat lover, we would like the topic to show up as “Cat-lover bio: John Smith” or “Dog-lover bio: Ralph McLeash” etc.

This is a really great feature! Is it still classed as experimental? I’m currently using an external form that posts by email to my forum, and I’d love to replace that with this, if there’s a sense that it’s going to stick around long-term.

3 Likes

I’m trying something where I use a checkbox to tell people how to fill in the title. It’s not ideal, but I think it’s the best alternative we have right now:

Screenshot 2024-02-19 at 8.38.10 PM

3 Likes

Just started playing around with this. First impressions: very nice! Thanks!!

As this expands, I would love to see:

  • Conditional fields, i.e. the text fields some forms add when you choose “Other” from the list of options.
    My specific case: If from the dropdown, you choose SonarQube, I want to then prompt you for its version

  • I would also love to be able to pull the values for a dropdown from some other place, presumably a post.

    Why? Let’s go back to the question of versions. Ideally, I wouldn’t prompt users to type them in free-form, but would give them a list of versions, latest first.

    The problem with this is two-fold

    • I want to present these lists in multiple different templates
    • versions keep being released

    Which means that with each release, I have n templates to update with the new version number, and hopefully I remember to update all of them. :crossed_fingers:

6 Likes

Our CSS changes (so far) In case it’s helpful to someone else:

// remove the grey background
.d-editor #form-template-form {
    background-color: var(--secondary);
}

// stop stretching the fields to 100% width
.form-template-field select, .form-template-field input {
    width: auto;
}

.form-template-field textarea {
    min-width: 650px;
    width: auto;
}
4 Likes

A post was split to a new topic: Renaming screenshots in the composer before posting

Thanks to everyone for the feedback. :slight_smile: I’m going to close out this announcements topic now and encourage anyone with any ux, feature, bug, or support requests for this feature to open a new topic in the appropriate category and pop a form-templates tag on it. :+1:

6 Likes