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 http://www2.epa.gov/, 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="http://search.epa.gov/epasearch/epasearch" 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-->
</div>
<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="http://www2.epa.gov/webguide/forms/contact-webguide" /> <!-- 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 -->
</form>

Top of Page

Required Search Fields

Name Values Comments
action intranet
internet
http://nlintrasearch.epa.gov/epasearch/epasearch
http://search.epa.gov/epasearch/epasearch
typeofsearch area
epa
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)
custom
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
date
Controls ordering of search results. Default is relevancy.
xml no
yes
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
name
Overrides the default EPA public access or intranet stylesheet.

Top of Page