Score:3

No results behavior not showing on a view

de flag

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?

No Sssweat avatar
ua flag
Lets rule out your custom theme. If you switch to the Drupal default theme "Bartik", does the no results text show?
Jaypan avatar
de flag
I'm using Bartik, and no, they don't show
Jaypan avatar
de flag
I should add, there is zero custom code on this site. It's all configuration.
No Sssweat avatar
ua flag
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](https://stm60dbea75e6026-uth77eeybufoinp5dgqwkpizkklodzl1.tugboat.qa/test) (user: admin pass: admin) with latest D9.
mx flag
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.
Jaypan avatar
de flag
Thanks guys. @NoSssweat that was a good tip for debugging, thanks. Prkos - good suggestions as well. It turned out to be something different though, adding my own answer.
Score:1
de flag

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

Jaypan avatar
de flag
I opened an issue on DO about this: https://www.drupal.org/project/drupal/issues/3222055
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.