Nested textfields are not excluded from autosubmit

Created on 17 October 2024, about 1 month ago

Problem/Motivation

Textfields that are nested in fieldsets or containers are not excluded from autosubmit.

Steps to reproduce

In our case, we have an exposed form with a geofield proximity filter with autosuggest, provided by the Geofield module. This filter wraps several textfields in a complex fieldset/container structure, depending how it's configured.
The form is set to submit automatically on change, but not for textfields.
But when you type something in the autosuggest field, the form submits immediately.

Proposed resolution

Apply the exclusion logic recursively so that nested textfields are properly processed.

πŸ› Bug report
Status

Active

Version

7.0

Component

User interface

Created by

πŸ‡©πŸ‡ͺGermany mrshowerman Munich

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

Merge Requests

Comments & Activities

  • Issue created by @mrshowerman
  • Pipeline finished with Success
    about 1 month ago
    Total: 218s
    #312585
  • πŸ‡©πŸ‡ͺGermany mrshowerman Munich
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Eh this seems by design.

    If you want to introduce a setting maybe that could work.

    The or exclude auto complete

  • πŸ‡©πŸ‡ͺGermany mrshowerman Munich

    Not sure if I get what you mean by that last line, but how can this be by design?

    If a site builder checks the option "Exclude textfields from autosubmit", they don't really care about those fields being nested in a fieldset or not. They just want all textfields in the form to not submit the form automatically.

  • First commit to issue fork.
  • Merge request !123Use JS for textfield autosubmit exclusion β†’ (Open) created by mdranove
  • Pipeline finished with Success
    24 days ago
    Total: 222s
    #323415
  • Putting aside the question of "as designed" for now, seems like this is a deeper issue beyond just nested textfields.

    I tested mr !122 with the suggested geofield module, and it's not able to add the "data-bef-auto-submit-exclude" attribute to the latitude/longitude fields because the type in the render array is set to "geofield_latlon" (see screenshot). The logic of the function relies on the "type" always being set to "textfield" or "entity_autocomplete" in order to apply the autosubmit exclude, but, as we can see with geofield, this is not always the case.

    I think this should be handled by JS so that the actual type attribute of the <input> element itself can be checked for the type="text" or type="entity_autocomplete". See MR !123.

  • Pipeline finished with Success
    24 days ago
    #323435
  • Pipeline finished with Success
    23 days ago
    Total: 239s
    #324194
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Let’s add some test coverage for this one

  • Pipeline finished with Success
    16 days ago
    Total: 1059s
    #330426
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    So test-only feature is showing as green when it should be failing.

  • Pipeline finished with Success
    about 13 hours ago
    Total: 362s
    #345171
  • Pipeline finished with Success
    about 13 hours ago
    Total: 238s
    #345197
  • Pipeline finished with Success
    about 13 hours ago
    Total: 319s
    #345199
  • Pipeline finished with Success
    about 12 hours ago
    Total: 427s
    #345256
Production build 0.71.5 2024