Skip to content

Preserve custom query parameters in index search forms #7640

@BriceFab

Description

@BriceFab

Problem

When a CRUD index page is opened with custom query parameters (e.g. menu-driven list context such as _status, _discipline, or sort state), those parameters are correctly preserved in links generated by AdminUrlGenerator / ea_url(), but they are lost when submitting the index search form in real browsers.

This is because the search form uses method="get". Browsers only submit form fields, not the query string embedded in the form action URL.

Example

  1. Open /admin/exercise?_status=to_complete
  2. Search for squat
  3. Browser navigates to /admin/exercise?query=squat_status is gone

Functional tests using Symfony's KernelBrowser may pass without a workaround because the test client merges query parameters differently than real browsers.

Current workarounds

  • Override search_form_filters in a custom crud/index template and add hidden fields for each custom parameter manually
  • Migrate list context to official EasyAdmin Filters (filters[...]), which are already re-applied on search via hidden fields in layout.html.twig

Expected behavior

Custom query parameters that are not reserved EasyAdmin keys should survive search submissions, the same way:

Related history

Proposed solution

Reuse the same hidden-field approach as the filters modal: preserve all remaining query parameters in the search form, excluding reserved keys (query, page, filters, batch params, etc.).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions