I had reviewed many forum and discussion related to the search form but it couldn't solve my problem.
The problem that I having is I want to add a value to the input type of text rather than it is empty by default.
Do any have this idea on how to solve it?

Comments

m_sabal’s picture

In modules/search/search.module, change the search_box function, updating the values for #title and #default_value to be what you are looking for. This isn't best practice, since it modifies a core module; but it's quick, global for all sites managed by your installation, and it works.

The correct way to do this is by overriding the default behavior. The search module allows you to change the form via a theme. The Zen theme has an example of how this can be done in zen.css.

simonlau_01’s picture

Thanks m_sabal.
I solve it.

simonlau_01’s picture

I found a forum of Drupal. There another solution to get the problem solve too which is embeded the codes below into template.php

$script = "if (Drupal.jsEnabled) {
$(document).ready(function () {
$('input#edit-search-theme-form-1').val('Enter search term...').focus(function() {
if($(this).val()=='Enter search term...') { $(this).val(''); } } );
});
};";
drupal_add_js($script, 'inline');

For this, I still having problem that when my mouse out which the search box is NULL, how I can make the default value "Enter search term..." appear back?

simonlau_01’s picture

Hi m_sabal.
I found a nice website that I can describe the search box effect that I want.

fatalfitness dot com

Try to click on it without type anything there.
Then, click at any empty space of the site.

The "Search social network" will appear.