1

I create a view display a books depend on url argument (book type name) ... And when book type name is not exist in book types list ... view be empty .. how can I when the url argument is wrong, display all books?

thank you

1

For contextual filters, the Views UI allows you to specify two different cases:

Case 1: If the filter value is not passed to the URL

In the contextual filter configuration, in the "When the filter value is not in the URL" section, you need to set the "Display all results for the specified field" option.

Case 2: If the filter value is wrong

In the contextual filter configuration, in the "When the filter value IS in the URL or a default is provided" section, you need to check the "Specify validation criteria" checkbox. Then, you can set the "Action to take if filter value does not validate" to "Display all results for the specified field".

You can see more details in the Views documentation: https://www.drupal.org/node/1578574

Hope it helps,

  • thank you for reply, but it work if the argument are empty not wrong .. how can do the same with worng argument? – Tasneem Apr 22 '15 at 10:27
  • @Tasneem, I have just edited my reply to include both cases. – dinopmi Apr 22 '15 at 11:48
  • thak you .. it's work – Tasneem Apr 22 '15 at 12:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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