2

Trying to figure out the best way of handling this scenario:

We have a data field for a entry type that should allow an editor in the CP to select one option from many (ie. a dropdown). However, we want to give the editors the ability to modify the options for this select list - and can't let them into a superadmin mode in the CP where they'd edit the original field parameters (if this were a dropdown field).

To do so, we're considering using categories. That presents easy UI in the CP to allow them to manage the list of options as needed, from which they'll select one when creating a new entry in the CP.

However, this piece of data isn't a category (as far as a user would think of it) so I am not certain if there is a more elegant way to handle this and avoid using categories? I looked for a field type that might do something like that but couldn't find one.

Thanks!

0

It sounds to me like a category is what you want - you just need to expand the user's concept of what categories are for.

If you want the choices to appear more like a drop down, you could use LJ Dynamic Fields, but you would still probably want to use categories for the underlying choices.

  • Yep, this is what we ended up doing. – Mike Apr 21 '17 at 16:45
0

I'm not 100% I follow, so I apologize if this isn't what you are looking for. Are these values being managed/edited within the CP? Or are the editors adding these values from a front-end form?

A project I worked on needed a base set of values in a drop-down field for each entry. But each entry that was created by the author could have additional values (or less). The way I did this was to create a table field in the CP. It consisted of two columns label and value.

This way I could have a "default" set of values that each entry would inherit. The author could then add additional rows (or remove) as they needed.

In the template, I just treated the table as a drop-down (in your case it will be a multi-select).

<option value="">Select</option>
    {% for option in entry.myField %}
        <option value="{{ option.value }}">{{ option.label }}</option>
    {% endfor %}
</select>

Hope this helps!

Edit/Update

I still think if you don't want to go the category route, you could do this within a field. I've attached a screenshot of what this looked like on a similar project. The label is the left column, and the value is the right. Each row is a new value in my drop-down field that is created on the front-end.

By default all of these values are in the dropdown for each entry. The author can add/remove whatever they want in addition to the default data. But, whenever "New Entry" is pressed, each entry starts with the same data.

Where it might get tricky is if you want these added/removed values to persist from entry to entry. You'd probably have to write some sort of plugin that saved the new values back to the original field.

enter image description here

  • Thanks Damon. I edited the question to hopefully make it more clear as to the fact this is all about doing this in the CP. Further, the idea is to allow the editor to maintain one definitive set of values - from which they select whenever creating a new entry in the CP (which is why we're thinking categories are the only way to achieve this). – Mike Mar 21 '17 at 9:08
  • Thanks Again Damon. You're right, we need things to persist from entry to entry but your solution might work with a plugin. However, since posting, we've set this up with categories and it seems to be working well so far. If we run into issues I didn't think about, I'll post them back here. – Mike Mar 23 '17 at 18:27
  • Right on! Sorry I was unable to help. – Damon Mar 23 '17 at 19:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.