Use theme function to change the search form input type I use the default search block provided by Drupal.
I want to change the type of this search text box from "text" to "search." How do I do this using a theme function?
There is no way to change the type of the search box form item with a theme function, but here's a theme friendly answer :-)

By default the Search input type isn't supported in Drupal 7, so you can't use any kind of hook_form_alter to change it out of the box.  You can do the following though to give you the ability to do what you want though:


Download and enable the Elements module from the awesome Dave Reid.
Add the following to your template.php file (you can omit the size - I just put it there to make the box a bit shorter):

function THEMENAME_form_alter(&amp;$form, &amp;$form_state, $form_id) {  
  if ($form_id == 'search_block_form') {
    $form['search_block_form'] = array(
      '#type' =&gt; 'searchfield',
      '#size' =&gt; '20'
    );
  }
}



This could also me done easily in a custom module, but I know you asked about theming specifically.