first of all: I just discovered the views fast search - and I aready love it.. how the search resuls just look like 'standard teasers' - this keeps a loot of tweaking/coding/theming away - and also the option to limit the search to certain node types etc....

But: I'm having a german site - and the submit button probably gets its text from the german translation: it shows "Speichern" which would mean "save" - which is a little bit confusing for a search page.. Is there an easy way to change that into something more meaningful like "Suchen" = "search"..?

thank you very much, greetz, till..

Comments

douggreen’s picture

I think that you can do this two ways, either in a custom module or in your theme. I'm certain that you can write a hook_form_alter that intercepts this form, which would allow you to change the $form['submit']['#value'] or something like that. I'm a little less certain that you can do this in the theme. But every view is themable. If you've never themed a view, you might try installing the theme views wizard for some hints on how to do this.

tille’s picture

hi douggreen - and thanks for your instant reply!

And thank you very much for your faith in my coding skills - but I must admit that at this moment I am pretty much clueless about how to actually theme/adjust zhis exposed filter.. That's at least how I have my setup made: the actualy search field/form is an exposed filter "search index" ..

I did then also have a look at the views theme wizard, but all I get is basically this:

/**
 * views template to output a view.
 * This code was generated by the views theming wizard
 * Date: 16. August 2007 - 16:46
 * View: search
 *
 * This function goes in your template.php file
 */
function phptemplate_views_view_list_search($view, $nodes, $type) {
  $fields = _views_get_fields();

  $taken = array();

  // Set up the fields in nicely named chunks.
  foreach ($view->field as $id => $field) {
    $field_name = $field['field'];
    if (isset($taken[$field_name])) {
      $field_name = $field['queryname'];
    }
    $taken[$field_name] = true;
    $field_names[$id] = $field_name;
  }

  // Set up some variables that won't change.
  $base_vars = array(
    'view' => $view,
    'view_type' => $type,
  );

  foreach ($nodes as $i => $node) {
    $vars = $base_vars;
    $vars['node'] = $node;
    $vars['count'] = $i;
    $vars['stripe'] = $i % 2 ? 'even' : 'odd';
    foreach ($view->field as $id => $field) {
      $name = $field_names[$id];
      $vars[$name] = views_theme_field('views_handle_field', $field['queryname'], $fields, $field, $node, $view);
      if (isset($field['label'])) {
        $vars[$name . '_label'] = $field['label'];
      }
    }
    $items[] = _phptemplate_callback('views-list-search', $vars);
  }
  if ($items) {
    return theme('item_list', $items);
  }
}

..and I have quite a hard time finding that input-button in that - and also the surrounding elements are either very well hidde, or just not there.. Well.

About the hook_form_alter: I had a look at the api - but also here I can't really figure out where/when/what should be altered..

thanks for any suggestions and/or pointers..:]

greetz, till..

Mauro Bieg’s picture

The problem is that the views search-field in English is labelled 'Submit'. This string is used for several buttons (e.g. also for submitting content). So you can't just translate the string. The views module developers should change that 'Submit' string and make it independent.

s.daniel’s picture

A workaround using css sprites.
Here is my code which you would have to change to what is fitting your site:

.view-VIEWNAME #views-filters #edit-submit {
background:transparent url(/sites/all/themes/YOURTHEME/images/SUCHE.gif) no-repeat scroll 0%;
border:0pt none;
color:#EEEEEE;
cursor:pointer;
display:block;
height:0px;
overflow:hidden;
padding-top:35px;
width:100px;
}

Basicaly the button is hidden and a background image with the desired text is visible and clickable in the padding-top. There are a few cases where this technic fails.

calebtr’s picture

Another way to do theme just the button on your exposed view is detailed at http://drupal.org/node/220200.

olafke’s picture

Status: Active » Fixed

I used the code from http://drupal.org/node/220200 and put it in my template.php in my themes folder and it worked perfectly fine.

<?php
/* Change the width of filter fields and the label of the submit button on the 'board' form */
function phptemplate_views_filters($form) {
  if ($form['#view_name'] == 'VIEWNAME') { //insert the name of your view here
   
    $form['filter3']['#size']=15; 
/*to manipulate the form fields look for the names of the form elements in the page source of the form and insert them where it says "filter3" */
    $form['submit']['#value']='Button text goes here'; 
  }
  return theme_views_filters ($form);
}
?>
Anonymous’s picture

Status: Fixed » Closed (fixed)

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