A Search Bar in Firefox for California Election Code
If you use FireFox, you can create search bars for almost any search form out there. I just created one for the California Election Code.

If you frequently find yourself searching the California Election Code, you might want to simply install this search bar plugin. I'll also give a quick tutorial for how to create your own if you search a body of code frequently (like the JAVA API for all you SIMS first-years).
[More:]
Please let me know if you find any of this confusing, unclear or incorrect.
Installing the California Election Code Search Bar in Firefox
- Download the following files:
http://pobox.com/~joehall/ca_elec_law/ca_elec_law.src
and
http://pobox.com/~joehall/ca_elec_law/ca_elec_law.png - Copy these files to the
searchplugins/folder in your FireFox installation directory. On my Mac, this is:
/Applications/Firefox.app/Contents/MacOS/searchplugins/ - Quit and restart FireFox.
- Now, you can use the California Election Code search bar by selecting the search with the california seal icon,
. Note: On the Mac, you can use the Command-K shortcut to jump to the search bar, and Ctrl-Up and Ctrl-Down to change search engines.
What About Other Search Forms?
Well, here's a way to adapt my plugin above to your frequently searched database of choice:
- Copy the SRC file from my example above and rename it to a short title for your new search bar.
- Open it in a text editor.
- Change the comments to reflect your details.
- Change the name of the plugin and the description to something appropriate for your new search bar.
- Open the search form for the search bar you want to create. Also, view the source in another window.
- Enter the URL of the search form as the
searchformparameter. - In the source code for the search form page, find the
FORMtag near the beginning of the page. Note that the method must be "GET" for this to work (that is, if it isn't GET, the mycroft scheme that I'm describing here won't work. See UPDATE below.).
Copy theactiontag plus the root URL for the site to the action parameter in the SRC file. For example, for the California Legal Code query form, theFORMaction is "/cgi-bin/calawquery". When I add this to the root URL for the form I get:
action="http://leginfo.ca.gov/cgi-bin/calawquery" - Do a typical query in the normal webpage-based search form that you'd like to be able to do from the search bar. Note other parameters that appear in the URL. Note which parameter is the query text (what you want to search for). The query text parameter goes in the
<input>tag withuserin it. The other parameters that appear in the URL for the executed query can be entered as additional unchanging<input>tags in the SRC file.
For example, a simple query on the CA Election Code returns:
http://leginfo.ca.gov/cgi-bin/calawquery?codesection=elec&codebody=test&hits=All
Note that in my SRC file I added the two parameterscodesectionandhitswith their typical values (note that lowercase/uppercase counts!). - For a simple "Semi-plugin" like my example, leave the
INTERPRETsection alone... this is for sidebar-returned search results. - Update where people can find your plugin in the
BROWSERsection of the SRC file. - Validate the syntax of your plugin. There you can also test it out and check the rendering of the search URL. Note: if you don't have a mycroft URL entered in the
BROWSERsection of the SRC file, the validator might alert you of this... you can ignore this until after you've submitted your plugin to mycroft. - Create a 16 pixel by 16 pixel PNG file for your search bar. Call it the same as the filename of your SRC file save the file extension.
- Copy the SRC and PNG files to the
searchpluginsdirectory of your FireFox installation. Quit and restart FireFox. Your plugin should now work. - You can submit your plugin to the mycroft search plugin database.
UPDATE [2004-11-29 11:41]: Actually, if you see a POST form, you can try to use the following bookmarklet (create a dummy bookmark and then copy and past this text (all one line) into its URL field):
javascript:(function(){var x,i; x = document.forms; for (i = 0; i < x.length; ++i) x[i].method="get"; alert("Changed " + x.length + " forms to use the GET method. After submitting a form from this page, you should be able to bookmark the result."); })();
Use this while you're at the form's page to try and change the POST to a GET. If it works, you can forget the form source ever said POST and just use GET in your plugin. (this is via the mycroft site citing Jesse Ruderman's bookmarklet page.