1

I'm running in to a situation that I don't know how to solve in Craft. I want admin CP users to select one entry from a list, and then based on that specific entry select a value from inside the selected entry from a dropdown.

We're using Craft to model a headless API through GraphQL and this dropdown selection affects business logic in my client application.

Research: looked at a few solutions, amongst which the https://plugins.craftcms.com/super-dropdown plugin. However, I couldn't find a way to capture the selected entry ID and fill the dropdown based on that value. So I don't think that's a way to solve this.

Basically what I would want to achieve.

  1. User selects the entry they want to reference to
  2. They select the desired field value from a conditional dropdown. The options are extracted from the selected entry.

Currently I've (sort of) solved the situation having the users type the value name in a separate text field. This is very fragile though, since a typo, change in value in the entry or even a space will not match it to the entered value in the original entry and break the functionality.

Graphic examples: Selected checklist, then select observation moment Possible values for the dropdown that the user should be able to select

1 Answer 1

1

There's nothing in Craft core that will solve that use case, and I'm not aware of any plugins that would either.

To make your current workaround a little bit more resilient, I'd suggest converting whatever field containing the values that you want to use on the entries, into to an Entries (or Categories) field (i.e. that all possible values, such as "Week 2", are represented as entries, instead of just text). Then, make the "Observatiemoment" field into an Entries (or Categories) field as well, targeting the same source. This way, authors will be able to select the values via the element selection modal, instead of having to type them – which at least removes the risk of spelling errors (even if it won't be possible to also limit the choices to only values selected in the selected "Checklist" entry).

1
  • Thanks for your response and tip regarding using entries/categories for the values! I kind of expected that it might not be available in Craft core.
    – Sietse
    Jan 15, 2022 at 14:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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