Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The examples below illustrate how to code search forms that perform search queries against the Google Search Appliance and the campus directory.

...

Search queries are sent to https://search.uci.edu/

The following inputs are accepted:

NameAccepted valuesDescription
qText string(required) The search query
type"Web" or "People"

(optional) Indicates the type of search to perform. Searches with type "Web" are routed to the campus search appliance. Searches with type "People" are routed to the campus directory. If no type or a type other than "Web" or "People" is indicated, the search is treated as type "Web".

domainText string(optional) Restricts search results to a defined UCI web property. Do not include protocol (use only "communications.uci.edu", not "https://communications.uci.edu"). Applies only to web searches; has no impact on directory searches.

Code Examples

The below are examples only and are not prescriptive. Feel free to experiment with different form markup.

To perform web searches only

This example uses minimal markup for a web-only search form.

Code Block
<form action="https://web.communicationssearch.uci.edu/php/searchgate.php" method="get">
	<label for="search-text">Search</label>
	<input id="search-text" name="q" placeholder="Search..." type="text"/>
	<button name="type" type="submit" value="Web">Go</button>
</form>

Adding an option to search the campus directory

Here we add a second button with a value of "People". 

Code Block
<form action="https://search.uci.edu/" method="get">
	<label for="search-text">Search</label>
	<input name="collectionid="search-text" name="q" placeholder="Search..." type="text"/>
	<button name="type" type="submit" value="Web">Web</button>
	<button name="type" type="hiddensubmit" value="uci_full"/People">People</button>
</form>

Restricting search results to a specified domain

The following example restricts search results to the  Communications website by adding a hidden input that supples the site domain. 

Code Block
<form action="https://search.uci.edu/" method="get">
	<label for="search-text">Search</label>
	<input id="search-text" name="q" placeholder="Search..." type="text"/>
	<button name="type" type="submit" value="Web">Web<>Go</button>
	<input name="domain" type="hidden" value="communications.uci.edu">
</form>

Accessibility considerations

All non-hidden form inputs must be labeled. In the above examples, this is accomplished by including a <label> element and associating it with the <input> by using the <input>'s id attribute value as the <label>'s for attribute value. However, this isn't the only way to label a form control; alternate methods are described on the W3C website: Labeling Controls.