-
-
Notifications
You must be signed in to change notification settings - Fork 571
Fieldsets cannot validate against a nested fieldset's value. #11721
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Are you able to reproduce the issue on a blueprint without any fieldsets, or can you only reproduce it when fieldsets are involved? Out of curiosity, does updating to |
@duncanmcclean I've tried whilst on |
Basically, setting up the blueprint in the same way (fields inside a Bard/Replicator, etc), but without using fieldsets. |
Works exactly as expected and as I'd like it to - |
Uh oh!
There was an error while loading. Please reload this page.
Bug description
I attempted to include some validation where I check that an imported fieldset (
link_type
) within a fieldset (card
, used as a set in a bard field in this instance) has a field containing certain value. This is so that some fields are only visible / validated when specific data in the imported fieldset is present. The issue is, the validation logic completely fails here, and didn't seem to be applying the correct checks.Some context for the screenshot: "Link Type" (handle
link_type
) is one of a number of fields imported as a fieldset into thecard
fieldset. The screenshot shows the card fieldset being used as a set within a bard field.We can see below that the image field is failing validation when the "Link Type" is equal to "Page / Story" (label for
collection
), despite theimage
's validation looking like this:See my initial message on the Statamic discord here.
How to reproduce
In my specific setup, I have an assets field called
image
inside of thecard
fieldset which I am using as a set inside a bard field.image
should only be required if thelink_type
field is not equal to "collection".link type
is contained within another fieldset that's imported intocard
, calledoptional_type_link
, so we only need to focus on these two fields (I'll include the entire fieldset for context though).So in order to reproduce, we need to import a second fieldset (
optional_type_link
) into the original fieldsetcard
, and then use the first fieldset within a bard field. The validation of the nested fields will fail. I know that I have the option to just add the fields directly tocard
, but I want to make my project dynamic, and there are multiple places that require these fields.resources/fieldsets/card.yaml
:optional_type_link
:We can see below that the image field is failing validation when the "Link Type" is equal to "Page / Story" (label for the

collection
handle).Logs
Environment
Installation
Fresh statamic/statamic site via CLI
Additional details
Worth noting that my Statamic installation was a fresh install of v4, into a Laravel 10 project. It has since been upgraded to Laravel 12 and Statamic 5.
The text was updated successfully, but these errors were encountered: