Form validation for unlimited field values

Created on 26 March 2025, about 2 months ago

Hello,

my following problem is, that i want to validate a link field with unlimited allowed values. I want to allow only domains starting with example.com, example.de or example.fr.

Is there any chance to got it working?

Best regards,

Marvin

💬 Support request
Status

Active

Version

2.1

Component

User interface

Created by

🇩🇪Germany killah89 Schneverdingen

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

Comments & Activities

  • Issue created by @killah89
  • 🇩🇪Germany jurgenhaas Gottmadingen

    Building the entity, then reading the field value into a token, which will be holding a list. Then you can loop through the list and check each value individually.

  • 🇩🇪Germany killah89 Schneverdingen

    Can you please give a more complex description or maybe an model example? Don't get it work. That would be great.

    Im starting with Validate form->Entity Form: Build entity->...

    Thanks

  • 🇩🇪Germany jurgenhaas Gottmadingen

    There is an action that can build the entity from the submitted form. And from that entity (which only exists in memory) you can then receive a multi-value field value, which should be a list. ECA has ways to loop through a list of values, examples are in the ECA Guide.

    However, I wonder if this would then run into the issue described in 🐛 Entity Form: Build Entity can't process unlimited values Active . This should hopefully be resolved soon.

  • 🇩🇪Germany killah89 Schneverdingen

    I'll checked the links and can't get it working. I was able to check a field value, but not with operator "begins with". When i'm creating a node, preview my work, go back to Form and change that value to an allowed one, it throws an error with previous value even if the current is allowed.

  • 🇩🇪Germany jurgenhaas Gottmadingen

    I'm not sure where the problem really lies. It could be to do with the multi-value field, but it could easily also be something wrong with the ECA model. With the given information, it's hard to tell for sure.

    You should try to create the simplest possible example to reproduce the problem on a fresh Drupal site. If we can reproduce it, maybe by using your simple model which shows the issues, then we have a chance to get to the ground of it.

  • 🇩🇪Germany jurgenhaas Gottmadingen
Production build 0.71.5 2024