How to target paragraph subfield with setErrorByName

Created on 1 April 2020, over 4 years ago
Updated 11 June 2024, 5 months ago

Hello everyone,

I am currently trying to show an error message in a validation function on a subfield of a paragraph using FormStateInterface::setErrorByName. My understanding is we just need to add the name of the field as the first parameter to show an error at that field however that doesn't seem to be working.

For my use case the field I'm targeting has the name attribute "field_content[0][subform][field_attr_name][0][value]", that's what I've tried entering as the first parameter.

Thanks

💬 Support request
Status

Active

Version

1.11

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇬🇷Greece chrbak

    Here is an example of mine from a paragraph field named "field_openings_period" with a datetime field "field_date_from"

    field_openings_period][0][subform][field_date_from][0][value

Production build 0.71.5 2024