Sample Area Search Form

There are two search collections: public access and intranet. The search box at the top of the One EPA Web template is coded to search the entire public access collection.

This page shows how to create a search form that searches only the current web area. As you can see, there's very little coding for you to do. The only element that changes from one area to another is the text that appears on the submit button.

Three things to be aware of:

  1. This search box only works for Drupal WebCMS content, because we know your current web area, the full name, and the contact us page for that area.
  2. The list of web areas is not updated in real time, so the there will be an overnight delay between when you create a web area, and when this code starts working for pages in that web area.
  3. This code only works for published pages on, because we capture information from the referrer, and HTTPS pages do not transmit referrer.

Should you want to search your Web Area, you can create your own Web Area search form. These forms can be embedded into content pages. The same rules apply for forms in static and dynamic content.

Basic search form example

  1. All parameter names must be in lower case.
  2. Parameter values may not contain <>&\.
  3. Use commas or vertical bars (|) to separate multiple terms in the value.

Search the Web Guide:

Search Form Code

<form action="" method="get">
<div class="form-item form-type-textfield">
<label for="what-look">What are you looking for?</label>
<input class="form-text" id="what-look" name="querytext" size="40" type="text" value="" /> <!-- do not edit the name attribute-->
<input class="form-submit" type="submit" value="Search Web Guide" /> <!-- Edit to reflect your web area name -->
<input name="typeofsearch" type="hidden" value="area" /> <!-- do not edit -->
<input name="fld" type="hidden" value="|webguide" /> <!-- Add the URL segment you want to search for; the initial pipe is required -->
<input name="areaname" type="hidden" value="Web Guide" /> <!-- Name of your Web Area -->
<input name="areacontacts" type="hidden" value="" /> <!-- Contact form for your Web Area -->  <input name="filter" type="hidden" value="sample4filt.hts" /> <!-- do not edit -->
<input name="result_template" type="hidden" value="epafiles_default.xsl" /> <!-- do not edit -->

Top of Page

Required Search Fields

Name Values Comments
action intranet
typeofsearch area
area searched only your web area.  Do not edit.  
epa searches the entire agency
areaname The plain English name of your area as it should appear in the search results. Keep it short! No ampersands (&).
fld URL string Separate multiple values with the pipe character (|). 
result_template epafiles_default.xsl(for public access)
agcyintr_default.xsl(for intranet)
Extensible style language stylesheet to render results. Do not edit (on public access pages).
querytext   Textbox for entering search terms.  Do not edit.

Top of Page

Optional Search Parameters

The fields below are optional both for intranet and public access search forms.  Do not specify the parameter if you are accepting the default.

Optional Search Fields
Name Values Comments
areacontacts A valid URL If present, this will be the link for "Contact us" in search results. If not present, "Contact us" will link to the Agency contact page.
areasearchurl A valid URL If present, this will be the link for "Advanced Search" in search results. If not present, "Advanced Search" will link to Agency advanced search.
doctype all | html | pdf Controls the type of document to return.  Default is all.  Use all except in special cases, since the user will have the opportunity to refine from the search results page.
sort term_relevancy
Controls ordering of search results. Default is relevancy.
xml no
Controls whether results are in XML format, or in HTML for visual presentation. Default is "no". "yes" is typically used by applications requesting results in machine-readable format.
stylesheet Custom stylesheet
Overrides the default EPA public access or intranet stylesheet.

Top of Page