• Resolved novice21

    (@novice21)


    I would like to change the search form so that there is no button but I can’t make it work right.

    Basically I want my search form to be a text box where users would type something and then press enter to activate the search. How would I change the code to do this? Is that even possible?

    <form method="get" id="searchform" action="<?php bloginfo('home'); ?>/">
    <input type="text" value="<?php the_search_query(); ?>" name="s" id="s" />
    <input type="submit" id="searchsubmit" value="Search" />
    </form>

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • It goes into your sidebar (or wherever) like this:

    <?php include (TEMPLATEPATH . '/searchform.php'); ?>

    and your searchform.php looks like this:

    <form method="get" id="search_form" action="<?php bloginfo('home'); ?>" />
    	<input name="s" type="text" class="search_input" id="s" onfocus="if (this.value == 'type keywords & hit enter') {this.value = '';}" onblur="if (this.value == '') {this.value = 'type keywords & hit enter';}" value="type keywords & hit enter" />
    	<input type="hidden" id="searchsubmit" value="Search" />
    Thread Starter novice21

    (@novice21)

    Thanks a bunch intricateratist! This works just fine!

    I only had to remove the & because my page wouldn’t validate, I changed instances of ‘type keywords & hit enter’ to ‘Search My Blog’

    I’m wondering if you know the answer to this, do you have any idea how to get the search page to return searches with ‘you have searched for ‘ [insert keywords] followed by the search results?

    Thanks again! I really appreciate your help

    novice21, the Search Results Count plugin will do just that for you.

    Showing 4 results for the search terms:  plate.

    https://www.village-idiot.org/archives/2007/05/26/search-results-count-plugin/

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Can you remove search form’s button?’ is closed to new replies.