Any nested Forms, like views Exposed Filters Do Not Work in Homebox

Created on 12 February 2022, over 2 years ago
Updated 31 October 2023, 8 months ago

Problem/Motivation

Views Filters do not function correctly when used within a Homebox panel.

The general problem is, that ANY form used as homebox portlet, like:

  • Custom form
  • Views
  • Webforms
  • ...

can not work by concept, as their <form> parent element is removed, as homebox already places a <form> for sorting and regions around all elements. Forms may never be nested!

This makes it quite complicated, but the good thing is, that similar projects also had to solve this, for example see
#3045171: Form blocks rendered inside layout builder break save β†’
https://git.drupalcode.org/project/dashboards/-/commit/2c6bf6e
But that concept is quite complicated.

Layout paragraphs, which has a similar problem in preview, disables the form elements:

Also see:
https://api.druphelp.com/api/drupal/core%21modules%21field%21tests%21src...
https://www.drupal.org/project/subform β†’
https://www.drupal.org/project/multiform β†’

Options:
a) Do not use a form for wrapping the homebox portlets, instead only use a form for the add widget and AJAX for the repositioning
b) Separate "Edit" mode from regular "Display" mode. Adding elements, dragging, removing, etc. is only allowed in edit mode. Edit mode disables form elements like layout paragraphs does or only uses their name as representation to work around this problem.
c) Find another technical solution to make the form in form work...?

Until that is solved, we mitigate the issue by showing a warning when embedding a form or view in settings.

Steps to reproduce

Create a View's Block with some exposed filters and insert it into a Homebox panel.
Change the filter and apply. The View refreshes but does not filter. It still shows all of the results.
I've tried with and without ajax enabled with no change in the outcome.
Note that the pager works. Only exposed filters are failing to function.

Alternatively, embed the search form or a Webform block.

πŸ› Bug report
Status

Fixed

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States 3CWebDev

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.

Production build 0.69.0 2024