Jump to content

Fieldtype for storing tags?

Michael van Laar

Recommended Posts

I would like to use typical tag fields for some projects. Nothing fancy, just a simple text input field which can either be filled manually with comma separated tags or by clicking on one of the tags listed underneath the field. So basically it should be a text field with an attached list of all the (comma separated) content which was filled into this field on other pages.

In MODX there is a special fieldtype for such tag fields, see attached screenshot from one of my MODX projects. I was wandering if anything like this already exists for ProcessWire, since I could not find anything like that.


  • Like 1
Link to comment
Share on other sites

Hi Michael,

I have not seen any fields like that, but as an alternative you could try using a "page" type field. It would create a new page for each tag, but has a nice friendly interface for the user to manage them.

1. Add a new page in your tree called "Tags Collection", and make it hidden.

2. Create a new field called Tags and make it a "page" type.

3. On the input field settings, make the "Parent of selectable page(s)" the Tags Collection page

4. For the "Input field type" try one of : Select Multiple, asmSelect or PageListSelectMultiple (I prefer the asmSelect)

5. Check the “Allow new pages to be created from field?” to allow the user to easily add new tags directly from the field

  • Like 5
  • Thanks 1
Link to comment
Share on other sites

I know that I could solve this with a page type field. But for my taste this is still not as easy to use as a “real” tag field.

I doubt that my developer skills are sufficient. But I will at least try to build a tag fieldtype.

Theoretically it should not be that difficult. One “only” has to preprocess all the content which is stored site wide in this field and create a clickable listing under the text field. A little jQuery onclick action and that’s it – at least in theory ;) And using Nico’s TextboxList module I think it could look really good.

  • Like 1
Link to comment
Share on other sites

There's no fieldtype or module for this, because PW already has all the things you need to do flexible and powerful tagging. Using page reference and the powerful inputfields it offers is the way to do it in PW, it's not an "alternative" way, it IS the way. It is far more flexible and powerful than what you have in MODX and most other CMS'.

Everything else that stores tags in a textfield comma separated isn't going to give you the power you usually need with tagging. You won't easily be able to use that in selectors and so on. If you're building a new fieldtype, inputfield for tagging, you don't really understand what PW offers already and you will using the same approach at the end anyway. There was already lots of discussions and people were trying to come up with modules or fieldtype for it, but none of them really is a better solution.

You can now install the Autocomplete module that comes with PW and use that to search and create tags on the fly. It has even improved from Ryan's blog profile, to create new tags without saving the page. The interface is simple and clients have no problem with it.

As mentioned before, I also mostly use ASM select and the Autocomplete feature. Takes couple minutes to setup and can flexibly be used to later expand and use the tag pages for different stuff like listings,sorting and filtering etc. The page find selectors are there to do powerful stuff with page fieldtype already. Further you can use the tag pages later on to expand it with additional fields for and image or description. Possibilities are endless and a feature I love the most in PW (one of the big reasons I love to use PW).

  • Like 7
Link to comment
Share on other sites

OK, meanwhile I had a deeper look at Ryan’s blog profile.

And of course using pages as tags is great, because you can add a description field (like you do with categories), which makes tag pages performing way better regarding SEO. I used pages as categories in my old MODX based blog. But adding new categories/tags was not as easy as it is here.

Link to comment
Share on other sites

  • 2 years later...


I'm new with ProcessWire, and I'm trying to model different kinds of pages in order to teach myself the system. Right now, I'm trying create a field similar to the tags field in the blog profile mentioned above. So far I seem to be hitting a wall, and I need some outside insight to find out what I'm doing wrong.

I tried following the guidance in this thread:

  1. I created a parent page for my "tags".
  2. I created a new field, and set the Type to "Page".
  3. Under the field's Details tab, I selected "Multiple pages (PageArray)".
  4. Under the field's Input tab, I set the page I created in step 1 as "Parent of selectable pages".
  5. I set the Input field type to "AsmSelect", and checked "Allow new pages to be created from field?".
  6. I added the field to a template, and used the template for a page.

But when I create a new page in the editor, my "tags" field is an empty select element, with no options, and no text input to create new pages.

So I downloaded and the blog profile mentioned above and created a fresh install to compare.

The "tags" field in the blog profile's editor looks and works perfectly, of course. But I can't figure out how to duplicate the settings in my own installation.

I checked the field settings, and they are almost identical to mine.

I see that the Input field type is set to "Select" in the blog profile, instead of "AsmSelect*", but using that setting doesn't change the outcome in my other installation.

I also see that the blog profile's "tags" field includes "Autocomplete Advanced Settings" under the Input tab, which is missing from mine. I installed the "Page Auto Complete" extension, and that setting is still missing.

Is it obvious what I have overlooked?

Thanks in advance!

Link to comment
Share on other sites

Look at the description of how to use "Allow new pages to be created from field?":

1. Both a parent and template must be selected above.
2. The editing user must have access to create/publish these pages.
3. The label-field must be set to "title (default)".

Have you specified a template new tags should use?


  • Like 1
Link to comment
Share on other sites

  • 1 month later...
  • 6 years later...

Because I landed on this thread the other day looking for the right module:

You don't need a module to implement a proper tag field. In the current version of PW (3.0), you can choose between many different Input field types for a PageReference, including input fields with autocomplete features.


  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...