Pet Peeve – Common Names for Search Fields
Posted by Jon Lee in Personal, Web Development, tags: facebook, google, HTML, input, pet-peeve, web developmentHere’s a rather strange pet peeve of mine: Search input fields that use common names. Allow me to explain.
When creating a form input field such as the search box, the <input> tag needs to have a name attribute so that the data can be passed via POST or GET. For example, the declaration for creating a search box might look something like this:
<input type=”text” name=”q” value=”" />
The Problem
The problem arises when many sites use the same name (”q” in this case, which undoubtedly stands for query). Many browsers give a drop down list of previous search queries you’ve made in input fields with the same name. Take for example Google and Facebook, both of these sites name their search box “q”. As a result, when I’m on Facebook I see a list of previous Google searches I’ve made and in Google I see a list of friends I’ve recently searched for on Facebook. Even within Facebook itself, they use the name “q” for many search boxes. Why would I need my friend searches to pop-up when I’m searching for an application?

This browser feature can be advantageous if used correctly. For example by naming your e-mail field “email” or your first name field “firstname”, you can make user browsing registration easier since a list of e-mails or first names (that they have entered while registering for other sites) will come up.
The Solution
The solution for this is simple — name your input field something else, ideally something descriptive. It’s okay if Google and MSN Live search both use the same field name since they’re both search engines. But it would make sense for Facebook to change their search field to “friendquery” or even just “f”, just not the same thing Google uses.
That being said, I don’t want to sound like a hypocrite but my search box on this blog uses the common name “s” which isn’t much better but at least users don’t see their list of Facebook friend searches pop up!
Just for Fun
Here are a list of popular sites and what name they use for the search fields.
- Facebook, Google, Gmail, Live Search: “q”
- Yahoo: “p”
- Wikipedia: “search”
- Amazon: “field-keywords”
- digg, jonlee.ca: “s”
This concludes my nerdy rant about search fields.
Popularity: 3% [?]
















Entries (RSS)
In all honesty… does it really matter?
In all honesty… not at all, just a little pet peeve
This site is truly web development blog now…
well sometimes it can be annoying that’s about it.
btw, in regards to your newer post – i suggest you write like a little tutorial on how to use facebook api – i think that would be VERY useful.