3

I have a view, and the no results behavior is not showing even when there are no results. The view shows all nodes tagged with the same term as the current node.

This is done with two relationships

  • One from the node to the taxonomy term
  • Another from the taxonomy term back to the content type

And two contextual filters

  • One on the node connected through the two relationships, to filter for all nodes tagged with the same term
  • One on the original source node, eliminating the node referenced in the URL from the results

The results are fields of the node (no relationship), shown in a table. I have checked the 'show the empty text in the table' box in the table settings, and I have added a global text area for the empty results behavior, showing a no-results message.

With the 'show the empty text in the table' box unchecked, nothing shows up on the page other than the page title. With the 'show the empty text in the table' checked, the table headers show up, but no empty results message.

Does anyone know what could be holding back empty results messages?

6
  • 1
    Lets rule out your custom theme. If you switch to the Drupal default theme "Bartik", does the no results text show?
    – No Sssweat
    Jun 30, 2021 at 1:04
  • I'm using Bartik, and no, they don't show
    – Jaypan
    Jun 30, 2021 at 2:42
  • I should add, there is zero custom code on this site. It's all configuration.
    – Jaypan
    Jun 30, 2021 at 3:06
  • Lets remove the complexity @Jaypan and do a simple case test. Create a new page view with contextual filter of ID and in its settings select provide a fixed value and give it a fixed value of 99999. Now, you should see the no results message; otherwise, perhaps there is indeed some custom code somewhere or you're missing some views/theme file maybe? I did a little simple case test here (user: admin pass: admin) with latest D9.
    – No Sssweat
    Jun 30, 2021 at 4:17
  • I'd check the Contectual filters settings. There are options there that affect what "no results" means in a way. Check the first option when there is no argument, and then after Validation if argument is present. Are you testing in Views Preview or actual page? You need both arguments in Preview.
    – prkos
    Jul 1, 2021 at 17:23

1 Answer 1

1

Thanks to debugging support from commenters in this issue, I discovered the problem. The default view required input for exposed filters before showing results. This setting had propagated to other views, including the ones without exposed filters. This created a weird bug where input would be required to show the user any result, including that there were no results. And with no exposed filters, there was no input to trigger this.

Solution: Advanced Settings -> Exposed Form Settings -> Exposed Form Style: basic

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.