By Fiasst on
Hello,
I need to add a label to the text input field in the search module. Can someone please show me how to do this. I'm quiet new to editing Drupal.
I think this is the php that creates the search form?:
/**
* Output a search form for the search block and the theme's search box.
*/
function search_box($form_id) {
// Use search_keys instead of keys to avoid ID conflicts with the search block.
$form[$form_id .'_keys'] = array(
'#type' => 'textfield',
'#size' => 15,
'#default_value' => '',
'#attributes' => array('title' => t('Search the HeliJobs site')),
);
$form['submit'] = array('#type' => 'submit', '#value' => t('Search Jobs'));
// Always go to the search page since the search form is not guaranteed to be
// on every page.
$form['#action'] = url('search/node');
$form['#base'] = 'search_box_form';
return $form;
}
and the label details:
<label for="edit-search-theme-form-keys">Search Jobs:</label>
I'm very grateful for any help!
Comments
Your solution, code with changes
Hi,
Your solution is given with changes done in code...
add the following code in a text field array ,
'#title'=>'Titlename',
/**
* Output a search form for the search block and the theme's search box.
*/
function search_box($form_id) {
// Use search_keys instead of keys to avoid ID conflicts with the search block.
$form[$form_id .'_keys'] = array(
'#type' => 'textfield', '#title'=>'Titlename',
'#size' => 15,
'#default_value' => '',
'#attributes' => array('title' => t('Search the HeliJobs site')),
);
$form['submit'] = array('#type' => 'submit', '#value' => t('Search Jobs'));
// Always go to the search page since the search form is not guaranteed to be
// on every page.
$form['#action'] = url('search/node');
$form['#base'] = 'search_box_form';
return $form;
}
--
Roshan Shah
T : 604-630-4292
Vancouver, Canada
Skype/GoogleTalk/Yahoo : bpocanada