Modify Views Exposed Filter

The task was to change text field to a select list with a given set of option. The text field was an integer field and the select options were numbers to select from 0 to 30.

<?php
/**
* Modify the work experience minimum and maximum text field to select list with options to select from 0 to 30.
*/
function ji_custom_form_alter(&$form, &$form_state, $form_id) {
  if (
$form_id == 'views_exposed_form' && $form_state['view']->name == 'search_openings' ){
   
$options =array();
   
$options[''] = '- Any -';
    for(
$i=0;$i<=30;$i++){
     
$options[$i] = $i;
    }
   
$form['field_opening_workex_min_value']['#type'] = 'select';
   
$form['field_opening_workex_min_value']['#options'] = $options;
   
$form['field_opening_workex_min_value']['#size'] = NULL;
   
$form['field_opening_workex_min_value']['#default'] = '';

   
$form['field_opening_workex_max_value']['#type'] = 'select';
   
$form['field_opening_workex_max_value']['#options'] = $options;
   
$form['field_opening_workex_max_value']['#size'] = NULL;
   
$form['field_opening_workex_max_value']['#default'] = '';

//    dpm($form);
 
}


}
?>