Conditional Required Field not Evaluating on Save with Autocomplete widget

Created on 10 March 2017, almost 8 years ago
Updated 24 July 2024, 5 months ago

When creating a condition for a non-required field and changing it to required based on a set of conditions, the required field isn't actually evaluating in the form presentation or validation.

Steps to reproduce:
1. Create 2 non-required fields
2. Make "Target field" required when for a certain value of the "Controlled by" field
3. Try creating a new node filling the "Controlled by" field with the needed value and keeping Target field empty.
4. You might need to remove the required parameter from the field, if you're using Chrome/Firefox/Safari

Settings:

Adding node:

How it should work:
When making a field required in dependence of another field, the form shouldn't be able to be submitted without the required field being filled.

πŸ› Bug report
Status

Needs work

Version

4.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States mikemadison Seattle, WA

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.

  • πŸ‡¨πŸ‡¦Canada liquidcms

    Doesn't work for me with 4.0.0-alpha1.

  • Status changed to Needs work over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States rishi kulshreshtha

    As far as I can observe, the problem persists with the radio button's widget.

    1. To address the issue, we need to create two fields: one list text field as the selector and one taxonomy term reference field as the target.
    2. The target field should be made required based on a value selected from the selector field.
    3. Although the target field shows the required asterisk, it fails to perform validation as expected.

    I have included a brief screencast demonstrating this issue.

  • Status changed to Postponed: needs info 10 months ago
  • πŸ‡«πŸ‡·France dqd London | N.Y.C | Paris | Hamburg | Berlin

    #28 your example video does not show the CF configuration and your required radio select field list includes N/A which can cuase issues too since nothing selected is also accepted then. We need more user reports on this. #26 and #22 report that they cannot reproduce the issue.

  • Status changed to Closed: cannot reproduce 10 months ago
  • πŸ‡«πŸ‡·France dqd London | N.Y.C | Paris | Hamburg | Berlin

    After rethinking: For now I set it as "Closed cannot reprocude" because this shouldn't be a BETA release blocker at all. Feel free to reopen with more details to reproduce this issue.

  • Status changed to Closed: works as designed 10 months ago
  • πŸ‡«πŸ‡·France dqd London | N.Y.C | Paris | Hamburg | Berlin

    And after testing on multiple installations (Drupal 10.1, 10,2, 9) I cannot find any point where CF is not working in the scope of this issue as expected. So after rethinking twice I mark it as "Closed (works as designed)" until somebody can clearly show me how this error occures and which version of Drupal is running and which other modules and fields are set up to investigate which other project maybe causes this misbehaviour injection.

  • Hello Dqd thank you for your work. I repeated what you illustrate in the animated gif and confirm the behavior when the widget is set to autocomplete. I was able to reproduce the problem however when i changed the widget to Select list. Could have a look to repeat your actions on a select list as well? thank you

  • Status changed to Needs work 5 months ago
  • πŸ‡ΈπŸ‡°Slovakia coaston

    +1 - It works fine with select list widget. However when you change widget to autocomplete - it does not work at all. It does not matter if it is required field, or visibility or anything else - it looks like autocomplete widget does not work at all!

  • πŸ‡ΈπŸ‡°Slovakia coaston
Production build 0.71.5 2024