Can topic templates have javascript?

Id like to create templates which have required fields, ideally these would be via dropdown selection boxes.

For example, if a field required the user to list their favourite animal they could choose from a box containing: “Dog, Cat, or Gargoyle”, I’d really like to provide options rather than have free form entry. Is this or anything similar possible?

If you use tags you won’t have to write a plugin that will be likely to break every time templates change upstream. I recommend that you spend an hour or so trying that before starting to write a plugin.

You can have a look at discourse-topic-previews/plugin.rb at master · paviliondev/discourse-topic-previews · GitHub for an example of creating Topic Custom Fields.

1 Like

Discourse is, at heart, a free form discussion software.

If what you really need is a strict form, you may have better results using a more appropriate software. You could embed solutions like Google Forms and Typeform to ease the transition for your users, like this example:


Thanks, I think my wording was bad, still want free form discussion but certain things are required to initiate that. I think using the tags and templates will be enough to make it work😀