1

I'd like to use the value of the chosen Exposed Filter (=dropdownlist) in the Global text block when there is no result.

In detail: Exposed filter (which is a taxonomy list) has 3 values of provinces:

  • Province 1
  • Province 2
  • Province 3

When there is no result using a chosen value, there should be a message (= global text, I presume), saying "Sorry, there are no addresses found in Province 2".

Is this feasible in Drupal views?

5
  • 1
    I think there is an existing feature to achieve a "no result behaviour" that displays a similar message with this king of token. I'm doing research :p
    – Djouuuuh
    Commented Aug 20, 2014 at 12:25
  • Go to advanced section in view.You will able to see "NO RESULTS BEHAVIOR". Add "Global: Text area" put you text wants to display in no results found case.
    – DRUPWAY
    Commented Aug 20, 2014 at 12:47
  • Thank you for your investigation, but I want to add the chosen exposed filter into the Global Text area within 'no result behavior'. Is that possible?
    – Hans V.
    Commented Aug 20, 2014 at 12:54
  • Mmmh I begin to think that you have to do this programmatically to use the $_GET values sent by the exposed filters form... I didn't found any token for that.
    – Djouuuuh
    Commented Aug 20, 2014 at 12:55
  • Unfortunately I am not a programmer... I have no clue how to develop this.
    – Hans V.
    Commented Aug 22, 2014 at 8:00

1 Answer 1

0
  1. set no result text area of view from advanced "No result behavior"
  2. then edit your view using hook views_pre_render

Access your exposed input in same hook using :

$view->exposed_input['your field name']

then in same hook set these fields:

$view->empty['area']->options['content'] = "Set your message"; ( append exposed filter here)
$view->empty['area']->options['label'] = "Set your label"

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.