Adding checkboxes fields


#1

Hello
I’m curently working on a filtering system. I’m using checkboxes, so the user can choose the categories for each project, and it can be filtered with Isotope. Each filters are displayed into the blueprint like

  categories:
    label: Categories
    type: checkboxes
    options:
      typo: Typography
      letter: Lettering
      print: Print
      identity: Identity
      web: Web

But I have to consider that additionals checkboxes field could be added later to increase the number of filters. I have think about “tag” field but with this system, we can’t really see the others words.

I’m looking for something like adding a checkbox manually and name it. Something like Multiselect plugin but with the posibility to add values. Do you have some advices ?


#2

Check out dynamic options (in this case, options from another field) in the docs: https://getkirby.com/docs/cheatsheet/panel-fields/checkboxes

This allows you to specify a field (for example in a parent page or in site settings) where you define those options for the checkboxes field.

This also works with the multi-select field.

fields:
  categories:
    label: Select categories
    type: multiselect
    options: field
    field:
      page: somepage
      name: tags
      separator: ,

#3

This is interesting, but I would like to let the user named his own checkboxes fields by himself, without any pre-coded list of fields somewhere.
For example, List field plugin let the user name each field, but it is not important for me to order them, and I would like to check them instead.


#4

But that is the whole point of this way to define the options, then the user can define the option somewhere and they are shown as options in the checkboxes or multi-select field?


#5

Ahh mhmmm, ok I see what you mean. Yes, this is a possibility, I agree.
I will use that but it sounds a little tricky to me (you could say to me : “Well, use tags directly”) : I keep some regrets that blueprints doesn’t have an option to let user adding any fields.

For example, it could be cool to have a simplified option like addfield: true inside the blueprints for each fields types : radio, checkboxes, text, textarea, etc…or maybe I’m off-topic.

Thanks you texnixe


#6

It doesn’t make sense to let the user add fields. Then the user would have to add code in the templates to output the content of these fields. You wouldn’t want a user to do that. If you want, give them my code editor plugin and you are in for trouble.


#7

The panel code editor looks interesting. Do you have any plans to develop it further, perhaps for Kirby 3?