You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Following on from this Discord thread, I found it unintuitive how to conditionally show/hide fields based on the value of an Entries field. I tried the docs for Conditional Fields, but it doesn't include this.
Context
A collection called Archive has an entries field called Archive type which allows users to select 1 (max items) entry from another collection called Archive type
Elsewhere on the Archive blueprint, I need to show/hide fields based on what the user choose in Archive type.
eg: If they choose Video, then show the field Video meta info
eg: If they choose Photo, then hide the field Video meta info
Condition that does not work
My instinct was to set the condition to equals video, but this doesn't work.
I also stabbed around trying various combinations using contains, ===, prepending with $root and collection::archive_type::
Solution / Workaround
get the ID of the Archive type entry of Video and use contains or contains_any (comma separating the IDs)
The above will show the Video meta info field if a user chooses Video or Interview for the Archive type.
I could raise a PR for the docs if someone feels this would be useful. Being able to select the relevant entries in the Conditions UI would be even better, but I'm not sure how many people using this approach.
The text was updated successfully, but these errors were encountered:
I was thinking this might be a good use case for a custom field condition to query against the slug and makes this a bit more readable, but that probably doesn't work since the data inside the conditions would be just the id, right? So no way to query the slug without major contortions.
Following on from this Discord thread, I found it unintuitive how to conditionally show/hide fields based on the value of an
Entries
field. I tried the docs for Conditional Fields, but it doesn't include this.Context
Archive
has an entries field calledArchive type
which allows users to select1
(max items) entry from another collection calledArchive type
Archive
blueprint, I need to show/hide fields based on what the user choose inArchive type
.Video
, then show the fieldVideo meta info
Photo
, then hide the fieldVideo meta info
Condition that does not work
equals video
, but this doesn't work.contains
,===
, prepending with$root
andcollection::archive_type::
Solution / Workaround
ID
of theArchive type
entry ofVideo
and usecontains
orcontains_any
(comma separating theID
s)Video meta info
field if a user choosesVideo
orInterview
for theArchive type
.I could raise a PR for the docs if someone feels this would be useful. Being able to select the relevant entries in the Conditions UI would be even better, but I'm not sure how many people using this approach.
The text was updated successfully, but these errors were encountered: