Theming the Search box submit button.

spatz4000 - January 4, 2008 - 18:46

I am trying to customize the search button that displays in my search block. I found this page:
http://drupal.org/node/154137 and I followed all the steps.

However when I refresh my site the old button is still displayed. Thinking it might be some sort of caching or file missing issue I checked the HTML source, but the overridden HTML is not in the source.

Is http://drupal.org/node/154137 the most up to date way to theme the search block for 5.5?

Any help would be appreciated.

Unless I am mistaken, that

bwv - January 4, 2008 - 19:45

Unless I am mistaken, that links help you customize the search form. The appearance of the button (color, size, etc.) is altered most easily -- at least in my experience -- in the CSS.

----------------------------------------------------------------------
http://www.bwv810.com/

I am a writer and researcher. In my spare time I build websites with Drupal.
Je peux communiquer en français. / Я могу общаться на русском языке.

from that page

spatz4000 - January 4, 2008 - 21:23

example: changing the Search button to an image

This can be done using CSS, but, if you want to change the button to an image using your search-block-form.tpl.php, you can simply change the following line:

from this:
<input type="submit" name="op" value="Search"  />

to this:
<input type="image" src="images/go-button.gif"  name="op" value="Search"  />

This replaces the SUBMIT button with an image called go-button.gif. Edit the path and filename to suit).

Also this is the code I placed in the tpl file and it should show up in my HTML source. It does not.

<label for="search_block_form_keys">Custom Search</label>
<input type="text" maxlength="128" name="search_block_form_keys" id="edit-search_block_form_keys"  size="25" value="" title="Enter the terms you wish to search for." class="form-text" />
<input type="submit" name="op" value="Search"  />
<input type="hidden" name="form_id" id="edit-search-block-form" value="search_block_form" />
<input type="hidden" name="form_token" id="a-unique-id" value="<?php print drupal_get_token('search_block_form'); ?>" />

All I can tell you is what I

bwv - January 5, 2008 - 12:59

All I can tell you is what I have done... If you want the button to be a different color, look for "form-submit" in your style.css and change the color and background (which below is white against black).

#search .form-submit {
  border: 1px solid #369;
  bgcolor: #000;
  color: #fff;
  font-size: 1.1em;
  height: 1.5em;
  vertical-align: middle;
}

----------------------------------------------------------------------
http://www.bwv810.com/

I am a writer and researcher. In my spare time I build websites with Drupal.
Je peux communiquer en français. / Я могу общаться на русском языке.

CSS all the way

pictogram - February 10, 2008 - 00:21

Here is some css definitions which control the items in the search box (compatible D5 & D6). This code only affects the search
box inputs, not all the input fields across the theme.

/* hides the Search label */
#search .form-item  label, /* Drupal 5 */
#search-block-form .form-item  label  /* Drupal 6 */
{
    display: none;
}

/* Affects the input text box */
#search .form-text, /* Drupal 5 */
#search-block-form .form-text  /* Drupal 6 */
{
    background-color: #FFF;
    color: #999999;
    border: 1px solid #CCC;
    font-size: 11px;
    padding: 2px;
    margin: 2px 0px 2px 0px;
}

/* Affects the input submit box */
#search .form-submit, /* Drupal 5 */
#search-block-form .form-submit  /* Drupal 6 */
{
    border: 1px solid #369;
    background-color: #000;
    color: #fff;
    font-size: 1.1em;
    height: 1.5em;
    vertical-align: middle;
}

pictogram

pictogram, thank you. i have

sw9 - September 23, 2008 - 17:39

pictogram, thank you. i have searched long and hard for something this concise.

 
 

Drupal is a registered trademark of Dries Buytaert.