How can I manage fields in Page Templates?
Asked by Jim_Jim:

I must be fundamentally misunderstanding how fields in Page Templates work. My assumptions are based on my experience with a system called "XWiki" that otherwise seems to be pretty similar to Confluence. I'm trying to replicate similar behavior, but if there is a different way that this is managed in the Confluence paradigm, I'm open to that.

In a nutshell: I want to have templates with-field based content. That is, the page should be a mix of text-based prose and value-based fields.

I can successfully add fields to a Page Template, and when I create a page from the template I do seem to be able to fill-out the fields (as fields) as expected, but then when I save the page, the fields seem to have been converted to freeform text! That is, they're no longer fields.

Also, I'd like to be able to add an additional field to my set of fields in the template. I can do that, but that new field only seems to be available to brand new pages, that is, pages that were previously created with the template don't contain the new field.

Lastly, I only seem to be able to create a simple text field, a multi-line text field, or a drop-down field. How do I create radio button fields, checkbox fields, multi-value checkbox fields, etc?

I wasn't able to find very detailed information in the Confluence documentation about how fields and page templates work, but maybe I'm not looking in the right place.

Thanks for your help!

Kind regards,

Jim


Answers:
author: Nic Brough -Adaptavist-
body: I am sorry to disappoint, but I think you started your question with a valid assessment - you have misunderstood fields in templates.

They are there to prompt or persuade the author of a new page (being built based on the template) to fill in things that will then become simple content. They're not form fields, they're just there to push good content.

As a random example, I might want to say "I grew up in \<town/city\> in \<county\>". A template could list UK towns and cities, and another list all our counties, in order that I don't just type in "I grew up in Redding in Barkshore". (Although, that sentence is still half-true - Reading used to be spelt Redding, and is still pronounced as Redding, despite being written as Reading)

Confluence's support for even those types of field is simple and does not implement other fields that would not translate to Confluence text when saved. Personally, I'd see a good use for multi-checkboxes to give you structured lists to come out as bullets or numbered lists, (e.g. select all the towns/cities you grew up in as a bullet list), but I'm not sure others are that useful.

TLDR: Confluence is not for forms, off-the-shelf, it's for writing unstructured text.

For filling in fields, Atlassian expect us to reach for Jira, where everything is contained in a field. A rough analogy is that Jira is a jumped-up spreadsheet, and Confluence a simplified word-processor aimed at publishing and structure instead of writing a book.

That said, there are apps in the marketplace that add forms and fields to Confluence. I am not going to pretend that I don't know where "Forms for Confluence" is from as my example, as I work for the vendor. I do intend the mention to be just an example though, I'm not trying to sell. Because I work there, I reach for it first as I have experts on-hand, and I've not looked for alternatives. I would always check the marketplace for others, as there is a chance something better for you is available.

\>Also, I'd like to be able to add an additional field to my set of fields in the template. I can do that, but that new field only seems to be available to brand new pages.

I have some complaints about the way Atlassian choose to name some of their things, but "template" is not one of them. Google's dictionary says "a shaped piece of rigid material used as a pattern for processes such as cutting out, shaping, or drilling." If you imagine the way those are used, you can see why they chose the word. You use a template to create the initial object and then modify it. If the template changes later, you don't go back and rebuild everything you built with the old template.

The template only matters for initial creation of the object. Once you've made version 1, the template is irrelevant to whatever you do in later versions.

So, good name, but it doesn't solve the problem that "I've got 1,532 pages with data that needs changing because something else changed" - three very broad approaches to that:

* include common text (the "include" macro is your friend, user macros can be great too)
* scripting or automatic updates (apps, but there are some damn good ones out there
* if it's global, move the shared stuff into the UI (use themes and include the data in there, so it's part of the UI, rather than content)


Tags: confluence-server

field

server

template