Jump to content

Feature Request: Dropdown Field


vknt
 Share

Recommended Posts

Hello,

I'm been using proceswire for a few simple sites now and I really like it. I'm now working on one where page has to have a "category" variable. So I would like to use a sort of dropdown field with 5 possibilities to choose from.

Is there technique/plugin to do this? Or would I have to use a series of checkboxes to a page?

Link to comment
Share on other sites

This can be done with "Page" field. Here is quick guide how to do it:

Create page "Categories". Under that page create all the categories you need to appear in dropdown (select field). I usually set up template called "pagereference" that has only title-field for this use, but actually any template is ok here.

Then on page where you need this category variable you set new field called "Category" and set it as "Page" type. Then on "Parent of selectable page(s)" setting choose page "Categories". That's it.

It may sound weird at first to use pages like this, but it is actually pretty brilliant and possibilities are endless. Of course in simple usage (like this) something more simpler (field type) could be nice and if I remember correctly there was some talks about "tag type" or something like this. But when you start building more complicated sites with more relations, then it is nice to have same logic everywhere.

But this is how you can do it now and this is pw-style of doing this. It is also common practice (well, heard from Ryan and I like to use it too :)) to set page like "Tools" and put page "Categories" under that page. This way your page tree will stay clean and organised.

Link to comment
Share on other sites

Thank you very much apeisa. I see how it works now. Don't need a dropdown-input anymore :)

Something else I've been struggling with, maybe you have another great technique to to tackle this:

I have a project page, with 3 videos. Each video should have a preview image and some other variables.

Like I understand PW now, I create a subpage of "project" called "video" and make a template that has all the inputfields. However it get's a bit ugly having to type in another title > /projects/projectname/projectnamevideo cuz most of the time, the video doesn't have a specific name.

How is this best approached PW-Style?

Link to comment
Share on other sites

Glad that I could help.

I don't know if there is better off the shelf solution for your problem. If I understood correctly you need something similar like images field, but for video with few variables + image. This is probably something that was discussed here: http://processwire.com/talk/index.php/topic,53.0.html (repeatable elements, matrix).

So for now you would need to create custom fieldtype or use what you have now (template and subpages). Of course my knowledge is limited on this issue so someone might know better answer for this.

Link to comment
Share on other sites

re:video

unfortunately, this might be one of the few examples, where matrix would be nice.

However, if I was doing this, I would probably create one page for holding all the videos [under e.g. '/videos/'], unavailaible for guests. All children pages of this video page would have all the fields you need for your videos.

Then, in the project pages itself, I would select correct videos via page field with multiple options checked, basically the very same way you set up your categories.

OT: As it was with the post that Antti linked, I still think the real question isn't about another field types, but rather creating better input system, that adds more variability in cases like this one – so you basically hack field types, but do it in a pretty package, so it doesn't really feel like hacked when working with it afterwards.

Link to comment
Share on other sites

Thanks again. I read through the thread, and it is indeed something that is needed in the future.

As your suggestion, this would become cumbersome in my usercase because it consists of a videocatalog containing more than 75 videos.. But thanks for the suggestion

Link to comment
Share on other sites

  • 1 month later...

Just wanted to let you guys know that I created a plugin that creates a Select/Drop Down field with configurable options.  :)

Check it out here: http://processwire.com/talk/index.php/topic,245.0.html

(I personally feel it is much more direct than creating pages for each of the items - in your case, categories - that you want in your drop down list.)

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...