In the Exposed Views form (Drupal 6, Views 2), I'd like to overwrite an input text so it render the option to choose from a range of values, something similar to this:
Or just a simple one: two text inputs with from and to labels (min, max, whatever, like a price range).
I am comfortable both with editing templates (views-exposed-form.tpl.php
in this case) and overwritting the form output:
function mymodule_form_alter(&$form, $form_state, $form_id) {
if ($form_id == 'views_exposed_form') {
$form['submit']['#value'] = t('Filter');
}
}
How can I change the defaul text input to one as described?
I am doing something similar as a template function. You can remove the rendered output and render your own as a theming function.
function THEME_preprocess_views_exposed_form(&$vars, $hook) {
switch($vars['form']['#id']){
case 'views-exposed-form-VIEW_NAME-page-1':
$vars['widgets']['filter-YOUR_FIELD']->widget = YOUR_CODE_HERE;
}
}
Be sure to use dpm() from the Devel module to figure the identifiers you need to use because might be slightly different in the theme layer.