Problem/Motivation
The Allow Only One module can be added, but when changing configuration options for the field type during setup, it presents an Ajax error.
In my case, the error is:
ResponseText: The website encountered an unexpected error. Try again later.UnexpectedValueException: The subform is not contained by the given parent form. in Drupal\Core\Form\SubformState->getParents() (line 92 of core/lib/Drupal/Core/Form/SubformState.php). Drupal\Core\Form\SubformState->getValues() (Line: 26)
The error's message makes me think directly to an incompatibilty with the 10.2 changes around forms and subforms in:
https://www.drupal.org/node/3386675
https://www.drupal.org/node/3391654
https://www.drupal.org/node/3347291
Other modules had this same type of issue, according to issues like:
https://www.drupal.org/project/metatag/issues/3419378
https://www.drupal.org/project/readonly_html_field/issues/3426382
https://www.drupal.org/project/custom_field/issues/3400256
https://www.drupal.org/project/datafield/issues/3409324
Steps to reproduce
- Install the Allow Only One module
- On the "Manage fields" of any entity bundle, add a field as follow.
- Add a field label
- Choose "Allow Only One" as the field type
- Click "Continue" button
- Under "Allowed number of values", change the setting and witness and Ajax error
Proposed resolution
- Make the Allow Only One module compatible with the Drupal core 10.2 field UI changes
Issue fork allow_only_one-3465556
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
joshua.boltz commentedComment #3
swirtThank you for reporting this @joshua.boltz. I will look into this soon.
Comment #4
kaise.lafrai commentedJust wanted to add an update here. I'm working on compatibility fixes for the next couple days. Thank you for your patience!
Comment #8
kaise.lafrai commentedA fix is ready for this issue that addresses compatibility with Drupal 10.2 and even Drupal 11.
Comment #9
swirtComment #11
kaise.lafrai commentedComment #12
kaise.lafrai commentedThank you for testing this Swirt!
Comment #13
swirtComment #14
swirtRelease in 1.0.3