]> git.evergreen-ils.org Git - working/Evergreen.git/blob - docs/opac/search_form.adoc
LP1615805 No inputs after submit in patron search (AngularJS)
[working/Evergreen.git] / docs / opac / search_form.adoc
1 Adding an Evergreen search form to a web page
2 =============================================
3
4 Introduction
5 ------------
6
7 To enable users to quickly search your Evergreen catalog, you can add a
8 simple search form to any HTML page. The following code demonstrates
9 how to create a quick search box suitable for the header of your web
10 site:
11
12 Simple search form
13 ------------------
14
15 [source,html]
16 ------------------------------------------------------------------------------
17 <form action="http://example.com/eg/opac/results" method="get" accept-charset="UTF-8">    <!-- <1> -->
18     <input type="search" alt="Catalog Search" maxlength="200"
19             size="20" name="query"
20             placeholder="Search catalog for..." />
21     <input type="hidden" name="qtype" value="keyword" />           <!-- <2> -->
22     <input type="hidden" name="locg" value="4" />                  <!-- <3> -->
23     <input type="submit" value="Search" />
24 </form>
25 ------------------------------------------------------------------------------
26 <1> Replace ''example.com'' with the hostname for your catalog. To link to
27     the Kid's OPAC instead of the TPAC, replace ''opac'' with ''kpac''.
28 <2> Replace ''keyword'' with ''title'', ''author'', ''subject'', or ''series''
29     if you want to provide more specific searches. You can even specify
30     ''identifier|isbn'' for an ISBN search.
31 <3> Replace ''4'' with the ID number of the organizational unit at which you
32     wish to anchor your search. This is the value of the ''locg'' parameter in
33     your normal search.
34
35 Advanced search form
36 --------------------
37
38 [source,html]
39 --------------------------------------------------------------------------------
40 <form role="search" id="searchForm" method="get" class="searchform" action="http://your_catalog/eg/opac/results" accept-charset="UTF-8">
41      <label id="searchLabel" for="search"><b>Search the Catalog: </b></label>
42      <input type="search" value="" name="query" id="search" size="30">   
43      <label id="search_qtype_label"><b>Type:</b> 
44      <select name="qtype" id="qtype"    aria-label="Select query type:">
45         <option value='keyword' selected="selected">Keyword</option>
46         <option value='title'>Title</option>
47         <option value='jtitle'>Journal Title</option>
48         <option value='author'>Author</option>
49         <option value='subject'>Subject</option>
50         <option value='series'>Series</option>
51      </select>
52      </label>  &nbsp;&nbsp;
53    
54      <label id="search_itype_label"><b>Format: </b> 
55      <select id='item_type_selector' name='fi:item_type' aria-label="Select item type:">
56        <option value=''>All Formats</option>
57        <option value='a'>Books and Journals</option>
58        <option value='i'>Nonmusical Sound Recording</option>
59        <option value='j'>Musical Sound Recording</option>
60        <option value='g'>Video</option>
61        </select>  &nbsp;&nbsp;
62      </label> 
63     
64     <label id="search_locg_label"><b>Library: </b>
65     <select aria-label='Select search library'   name='locg'>
66             <option value='1' class="org_unit"> 
67                 All Libraries 
68             </option> 
69             <option value='2' selected="selected" class="org_unit"> 
70                &nbsp;&nbsp;Central Library
71             </option> 
72              <option value='10'   class="org_unit"> 
73                 &nbsp;&nbsp;&nbsp;&nbsp;Little Library
74             </option> 
75      </select>        
76      </label>
77           <input class="searchbutton" type="submit" value="SEarch" />                  
78 </form>
79 --------------------------------------------------------------------------------
80
81 Encoding
82 --------
83
84 For non English characters it is vital to set the attribute `accept-charset="UTF-8"`  in the form tag (as in the examples above). If the parameter is  not set, records with non English characters will not be retrieved.
85
86 Setting the document type
87 -------------------------
88
89 You can set the document types to be searched using the attribute `option value=` in the form. For the value use MARC 21 code defining the type of record (i.e. https://www.loc.gov/marc/bibliographic/bdleader.html[Leader, position 06]).
90
91 For example, for musical recordings you could use `<option value='j'>Musical Sound Recording</option>`
92
93 Setting the library
94 -------------------
95
96 Instead of searching the entire consortium, you can set the Library to be searched in using the attribute `option value=` in the form. For the value use Evergreen database.organization unit ID. 
97
98