Hi

I have developped a module in order to overide the filter in views :

function helper_form_views_exposed_form_alter(&$form, $form_state) {
if ($form['#id'] == 'views-exposed-form-Banks-page-1') {
    db_set_active('banks'); 

    //Populate the Bank Select Box 
    $bank_result = db_query('SELECT DISTINCT(Static_Info.Company_Name) FROM {Static_Info}');
    while ($row = db_fetch_array($bank_result)) {
      $bankNameOptions[$row['Company_Name']] = $row['Company_Name'];
     }


    $form['Company_Name']['#type'] = 'select';
    $form['Company_Name']['#multiple'] = TRUE;
    $form['Company_Name']['#size'] = 5;
    $form['Company_Name']['#options'] = $bankNameOptions;


    db_set_active('default');


}
}

It s working fine when I select only one item in the select box, but if I select more items because it s a multiple select I have no result and the query is only showing one :

SELECT Static_Info.Company_Name AS Static_Info_Company_Name WHERE (Static_Info.Company_Name) = ('Bank of America')

instead of something like this :

SELECT Company_Name From Static_Info WHERE (Company_Name = ('Bank of America') OR Company_Name =('HSBC'))

I m kind of new with hook_form_alter, Am I missing something, I m ?

Comments

R.Hendel’s picture

Issue tags: +dvcs11

Hello,
is your issue still active?

This is very old and I would fix this to clean queue.
Please feel free to reopen it. Otherwise it would be automatically closed after two weeks.

R.Hendel’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)
Issue tags: -dvcs11

Automatically closed -- issue fixed for 2 weeks with no activity.