Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 840665
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T05:39:45+00:00 2026-05-15T05:39:45+00:00

I am using a customised version of search-theme-form.tpl When I use the search box,

  • 0

I am using a customised version of search-theme-form.tpl
When I use the search box, I do get transferred to the search page. But the search does not actually take place. The search box on the search results page does work though. This is my search-them-form.tpl.php file (demo :

<input type="text" name="search_theme_form_keys" id="edit-search-theme-form-keys" value="Search" title="Enter the terms you wish to search for" class="logininput" height="24px" onblur="restoreSearch(this)" onfocus="clearInput(this)" />
  <input type="submit" name="op" id="edit-submit" value="" class="form-submit" style="display: none;" />
  <input type="hidden" name="form_token" id="edit-search-theme-form-form-token" value="<?php print drupal_get_token('search_theme_form'); ?>" />
  <input type="hidden" name="form_id" id="edit-search-theme-form" value="search_theme_form" />

There is also a javascript file involved. I guess it’s use is pretty clear from the code:

 function trim(str) {  
     return str.replace(/^\s+|\s+$/g, '');  
 }  

 function clearInput(e) {  

        e.value="";                // clear default text when clicked  
    e.className="longininput_onfocus"; //change class

 }  

 function restoreSearch(e) {  
    if (trim(e.value) == '') {  
        {
   e.value="Search";             // reset default text onBlur 
         e.className="logininput";        //reset class
  } 
    }  
 }

What can be the problem and how can I fix it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T05:39:45+00:00Added an answer on May 15, 2026 at 5:39 am

    Apparently, you cannot directly modify the HTML in search-theme-form.tpl.php since thats not the right way to do it. So my adding the class and onFocus and onBlur attributes was the problem.

    The correct way to do it is to modify the themes template.php file. Basically we will be using form_alter() to modify the form elements. Since using the HTML way is wrong. Take a look at the code below (taken from : here )

    <?php
    /**
    * Override or insert PHPTemplate variables into the search_theme_form template.
    *
    * @param $vars
    *   A sequential array of variables to pass to the theme template.
    * @param $hook
    *   The name of the theme function being called (not used in this case.)
    */
    function yourthemename_preprocess_search_theme_form(&$vars, $hook) {
      // Note that in order to theme a search block you should rename this function
      // to yourthemename_preprocess_search_block_form and use
      // 'search_block_form' instead of 'search_theme_form' in the customizations
      // bellow.
    
      // Modify elements of the search form
      $vars['form']['search_theme_form']['#title'] = t('');
    
      // Set a default value for the search box
      $vars['form']['search_theme_form']['#value'] = t('Search this Site');
    
      // Add a custom class and placeholder text to the search box
      $vars['form']['search_theme_form']['#attributes'] = array('class' => 'NormalTextBox txtSearch', 
                                                                  'onfocus' => "if (this.value == 'Search this Site') {this.value = '';}",
                                                                  'onblur' => "if (this.value == '') {this.value = 'Search this Site';}");
    
      // Change the text on the submit button
      //$vars['form']['submit']['#value'] = t('Go');
    
      // Rebuild the rendered version (search form only, rest remains unchanged)
      unset($vars['form']['search_theme_form']['#printed']);
      $vars['search']['search_theme_form'] = drupal_render($vars['form']['search_theme_form']);
    
      $vars['form']['submit']['#type'] = 'image_button';
      $vars['form']['submit']['#src'] = path_to_theme() . '/images/search.jpg';
    
      // Rebuild the rendered version (submit button, rest remains unchanged)
      unset($vars['form']['submit']['#printed']);
      $vars['search']['submit'] = drupal_render($vars['form']['submit']);
    
      // Collect all form elements to make it easier to print the whole form.
      $vars['search_form'] = implode($vars['search']);
    }
    ?>
    

    In yourthemename_preprocess_search_theme_form – ‘yourthemename’ will obviously reflect the name of your custom theme. Basically the code is self-explanatory. what with the comments and all.

    So, basically thats the way it works.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i'm using the customised cell to Show an image. But, when i add an
I am using a customised version of the mapview (OSMDroid version). I am using
I build a customized search web page using some other search engine. like. For
I need to customize iReport sources.. (not creating plugin) Currently i am using iReport
I'm using svn for the first time, to maintain a custom version of Wordpress.
In my application, i'm using a customised table. Each cell have an uibutton and
I've been using PHP version 5.2 and now need to upgrade to version 5.3
I've been using swfobject for a recent project, and its great. But now that
I'm using the jQuery UI Autocomplete plugin (version 1.8), and I'd like to customize
How do I customize an existing Dojo widget? I'm using dojo version 1.3. In

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.