"Undefined index: #parameters" and other error in custom module Original question at the bottom. Quick summary, I needed a way to remove the comma character from views exposed filter queries. Below, I was given an example of custom module to do this using validation, which I used and barely modified. However, I'm getting the errors:  

Notice: Undefined index: #parameters in search_helper_form_alter() (line 6 of /Applications/MAMP/htdocs/drupal-7.12_old/sites/all/modules/search_helper/search_helper.module).

Notice: Trying to get property of non-object in search_helper_form_alter() (line 6 of /Applications/MAMP/htdocs/drupal-7.12_old/sites/all/modules/search_helper/search_helper.module).

Since I've never written a module before, I'm not sure how to interpret these errors. I'd really appreciate any suggestions. Here's the code.

&lt;?php
function search_helper_form_alter(&amp;$form, $form_state, $form_id) {  
    switch($form_id) { 
        case 'views_exposed_form': 

        if ($form['#parameters'][1]['view']-&gt;name == 'views_exposed_form_address_search_page') { // name of the view
            // display array, you have to enable devel module
            //$output .= dsm($form); 

        $form['#validate'][] = 'no_commas';
   }
  break;  
 }    
}
function no_commas($form, &amp;$form_state) {
  $form_state['values']['d'] = preg_replace(",", ' ', $form_state['values']['d']);
}
?&gt;


Original question: I've been trying to set up a location search using views exposed filters and various methods of storing information. The problem inevitably arises that users obviously will want to search for a location using a comma (San Diego, CA or Portland, OR), but the comma isn't stored with the locations anywhere. So, if they search for San Diego or they search for California it works fine, but when they search for both using comma separation, they query returns no results. Is there a way to remedy this? The best way to do this, it seems, would be to ignore the comma within the query somehow. It's been driving me crazy for quite some time now how to get this working. Any help would be appreciated.
You could write a small custom module that -


Form alters views exposed filter form of the particular view in question
Add a new validate function to the form above (validate function is called before the actual form submit function is called and allows you to manipulate values)
Then in the validate function you could edit the particular exposed filter form field replacing commas with nothing.


Here is a sample code that I found on Googling around - http://drupal.org/node/716420#comment-2634540

Hope this helps.