I'm trying to get exposed filter selected value in hook_form_alter().
myModule_form_alter(&$form, $form_state, $form_id) {
if ($form['#id'] == 'views-exposed-form-view-id-display-id'){
var_dump($form['exposed_element']['#options']);
}
}
i tried with also
$form['exposed_element']['values'],
$form['values']['exposed_element']
$form['exposed_element']
But none of them giving me selected option value.
Any help/suggestion would be greatly appreciated.
EDIT
For more clarification
function myModule_form_alter(&$form, $form_state, $form_id) {
switch ($form_id) {
case 'views_exposed_form':
switch($form['#id'])
{
case 'views-exposed-form-soldproduct-page-1':
var_dump($form['exposed_element']['#options']);
break;
}
break;
}
}
Where soldproduct is my view name and page-1 is the view display id.