Skip to content

Views admin UI proximity filter setting does not update dynamically based on other setting changes #62

@indigoxela

Description

@indigoxela

This is only a problem in views UI. This is the form in the dialog:

Image

Multiple other settings in the same form should influence the form widget, but none of them does by AJAX:

Different types of proximity plugins have different input forms for the value.

The operator also has some influence (between, not between obviously needs two distance inputs).

Grouped filters have a table style display with multiple of those form items, each row has its own operator setting (not visible in this screenshot). But grouped filters with complex forms are a topic on its own in views. 😉

There's a callback - geofield_views_ui_change_proximity_widget(), but that only works with Javascript disabled and also then in limited cases.
Although there's some JS, this can never work, as this form isn't cached. As it's not available from the tempstore, validation for the form token fails.
Same problem occurs, if we'd switch to #ajax - failing form token validation.

The only thing that might work is to switch to an ajax path (not callback) with custom PHP and JS code. But still tricky.
This is a known problem in Drupal 7 which never got resolved.

And in D10 proximity search is substantially different.

A tricky bug.

Workaround

Super silly, but the only way. Whenever you have to change either of the 3 form values:

  • Source of Origin Point
  • Operator
  • Grouped filters

Submit the dialog twice. The first time change the value that should trigger a form change, then open the dialog again, possibly change depending values and submit again.
The double dialog submit is the trick.

Awkward, though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions