- Issue created by @kevinquillen
- 🇺🇸United States kevinquillen
I think this is because of submit buttons not having a unique #name value. If I give Remove a unique value like 'remove_token_$i' then extract that element in the ajax callback, the issue goes away.
- First commit to issue fork.
- Merge request !817Issue #3539885: adding distinct names with string prefix → (Merged) created by sijumpk
- 🇮🇳India sijumpk
Kevin, you are right. In a table form element, if we use integer indexes, these buttons do not get grouped properly in the input array. Added the proposed changes and raised the MR. Please review.
- 🇮🇳India sijumpk
A warning was also being generated due to the type of the #limit_validation_errors value. As per the documentation, that value should be an array or null. Adding fix for that issue as well.
Warning: foreach() argument must be of type array|object, true given in Drupal\Core\Form\FormValidator->handleErrorsWithLimitedValidation() (line 151 of /var/www/html/web/core/lib/Drupal/Core/Form/FormValidator.php)
- 🇺🇸United States kevinquillen
In that case this change should likely apply to both the variables and token section, not just the token section.
- 🇬🇧United Kingdom scott_euser
Thank you for the work on this! Added a nitpick in addition to Kevin's comment in #8 but would be good to add a tiny bit to the test here to ensure removal continues to work in the future https://git.drupalcode.org/project/ai/-/blob/1.2.x/tests/src/Functional/...
Thank you!