Dan
Dan

Reputation: 1719

Change the url for search input

I have a search form on a Drupal page (A custom view) that searches all my articles:

URL: www.site.com/articles

<form> 
  <input type="text" placeholder="Search Library" class="searchbox">        
  <button type="submit" id="edit-submit" name="op" value="Search" class="form-submit">Search</button>
</form>

When a user submits this form I get a string appended to the end of the url like this:

www.site.com/articles?search_fulltext=SEARCHTERM&op=Search

The problem is that it's not working, and to get it to work I have to search from a different page like here:

www.site.com/search?search_fulltext=SEARCHTERM&op=Search

So ultimately I would like to have my search box on a page, but when a user submits I want it to reference another url:

www.site.com/search?search_fulltext=SEARCHTERM&op=Search

I basically want to have a search box on a different page that is being searched. If that makes any sense. :)

Upvotes: 0

Views: 948

Answers (1)

Joshua Whitley
Joshua Whitley

Reputation: 1186

Use the <form> tag's action attribute to submit the form to the search page like:

<form action="http://www.site.com/search">

I also just realized that you are probably only looking to search specific content types so you may wish to look into the Custom Search module (http://drupal.org/project/custom_search).

Upvotes: 1

Related Questions