2

Basically I want to have entries with field types that provide links to either a category or an entry. I'm guessing such a fieldtype doesn't exist, so... I can use WB Category Select for selecting the category and whatever native or Playa for selecting an entry, but is there any way to toggle between them?

Like a radio fieldtype or something that will show/hide a set of fields?

E.g.

Choose a type of link and link itself [#n...]

  • Category (clicking this reveals WB Category Select, hides the other)
  • Entry (clicking this reveals single Entry selection, hides the other)

The above in repetition. Matrix/Grid isn't necessary, can manually make a bunch of repetitive fieldtypes.

Probably doesn't exist either, so any recommendation for an existing radio/switch/pill type and binding some javascript to it for the toggle functionality?

edit:

Props to Max & Tyler who recommended the Entry Type add-on. That was exactly what I needed. Have implemented it already, it's perfect.

4

possible I misunderstand the question.

You can try Entry Type - dropdown fieldtype that shows/hides other fields on the publish page.

6
  • Wow. This might be perfect. Wouldn't have figured by the add on name. Tangent: Btw I've been trying to upgrade MX Select Plus' Chosen to 1.x to try out some features in their branches. Guess I'll keep you posted eventually.
    – notacouch
    Jan 29 '14 at 16:14
  • 1
    I'm testing now new version of MXSP where I replace Chosen with another plugin which give better UI and new functions.
    – Max Lazar
    Jan 29 '14 at 18:05
  • Does it have the option to select multiple items simultaneously (as we would in a native multiselect dropdown)?
    – notacouch
    Jan 29 '14 at 21:01
  • yes, but this option is also exist in Chosen. Or you mean something different?
    – Max Lazar
    Jan 29 '14 at 21:03
  • As in if I click and drag I can select multiple items. That's in chosen already?
    – notacouch
    Jan 29 '14 at 21:05
1

Suggestion: use a Matrix or Grid field with two columns: one contains a Relationship field (to link to an entry), the other contains WB Category Select, and instruct users to fill out only one or the other for each row.

You can enforce this one-or-the-other setup in your template using a conditional (in case someone selects both):

{matrix_field}
    {if relationship}
        {relationship:title}
    {if:else}
        {category}
    {/if}
{/matrix_field}
1
  • Nice. But you never know when the user may leave both filled in so they can swap values later. Having a radio fieldtype of some kind ensures we only stick to 1/2 values, however, it could be confusing if both are still visible (e.g. they forget to check the proper radio). Nevertheless some extra conditionals should be used just to be safe anyway. Thanks.
    – notacouch
    Jan 29 '14 at 16:11
1

Rob Sanchez developed a really great add-on called "Entry Type" (http://devot-ee.com/add-ons/entry-type). Make a note of this one for future projects ;)

You can configure an Entry Type field in the Channel Fields for the relevant channel and show/hide fields based on the value of the Entry Type field's selection. This way, based on the value of the Entry Type field and the settings that you control, you can toggle the visibility of the fields.

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.