Monday, 24 January 2005

Use this form to search profiles

[Edited 17 Feb 2005 to amend the code to insert in templates, to open search results in new window without problems - thanks to G-BOAC on Blogger Forum]
[Edited 2 Feb 2005 to include the full code to insert in templates]
[Edited 16 May 2005 to include much simpler HTML code for the same search form]
Note: if you're looking for other ways to search, like searching Blogger's help or searching blogs, try this post!

Blogger have not provided a search facility for their profiles, yet. So here's a form to search profiles for interests, books, music and movies (updated Aug 07) or industry or occupation (also in my sidebar, you need to scroll down towards the end) - feel free to try it out (results open in a new window).

For a more comprehensive profile search, where you can search for any words within any bit of the profile, see this post.

I figured out how to add a simple form to my sidebar which anyone can use to do a search for certain words (like "vocal music" or even "tea"!) within the various sections (like interests, books, movies or music) of member profiles, having worked out the search syntax recently (see my earlier blog entry).

I've now included two versions of the code, Javascript and then (at the end of this post) a much simpler HTML version.

Any feedback would be welcome though be warned that I'm no Javascript or indeed HTML expert, I just adapted the script from one by Petra Richardson (to whom many thanks are owed).


Here is the Javascript code for the profile search form which you can just copy and paste into your template sidebar if you want to use it in your own blog (I put it under a sidebar heading entitled "Search profiles", but that's not necessary; also note that I haven't yet worked out how to get it to open the search results in a new window without the original window going weird, so it opens them in the same window):

<script language=javascript>
//results open in new window, to change this
//edit target on selectedIndex e.g. target=_self
//by Improbulus
// licensed under Creative Commons License
//- based with thanks on code by Petra Richardson at
//and thanks to G-BOAC of Blogger Forum for the fix
//to open results in a new window properly

function send_search()

if(window.document.searchengine.engine.selectedIndex == "0")

if(window.document.searchengine.engine.selectedIndex == "1")

if(window.document.searchengine.engine.selectedIndex == "2")

if(window.document.searchengine.engine.selectedIndex == "3")

<!-- below are the submission forms -->
<form name=interests action="" method="get" />
<input type="hidden" name="t" value="i" />
<input type="hidden" name="q" />

<form name=movies action="" method="get" />
<input type="hidden" name="t" value="m" />
<input type="hidden" name="q" />

<form name=music action="" method="get" />
<input type="hidden" name="t" value="s" />
<input type="hidden" name="q" />

<form name=books action="" method="get" />
<input type="hidden" name="t" value="b" />
<input type="hidden" name="q" />

<!-- below is the multiple search box that you will see on your webpage -->

<form name=searchengine method=post action="javascript:send_search()">
Find this word or phrase:
<input name="search" type="text" size="25">
within this profile section:
<select name="engine">
<input type="button" value="Search profiles" name="B1" onclick="javascript:send_search()">


[Added 16 May 2005:]I've just figured out a much simpler search form, which produces exactly the same result, using HTML rather than Javascript.

Here's the code (updated Aug 07 to search for industry or occupation too):

<!-- Please do not delete this note
Form to search profiles - results open in new window, to change this delete target="_self"
Copyright Improbulus 2005-2007 licensed under Creative Commons License
<form action="" method="get" target="_blank">
<label for="q">Find this word or phrase:</label><br />
<input type="text" size="25" name="q" id="q" /><br />
<label for="t">within this profile section:</label><br />
<select name="t" id="t">
<option value="i">Interests</option>
<option value="m">Movies</option>
<option value="s">Music</option>
<option value="b">Books</option>
<option value="j">Industry</option>
<option value="o">Occupation</option>
<input type="submit" value="Search" /> <input type="reset" value="Clear" />

The working search form is at the top of this post as well as in my sidebar (scroll down to the bottom of the sidebar).

As for how I figured out the simpler version, see this post.


c_neil said...

This thing is great!

Improbulus said...

Thanks c_neil, glad you found it useful.

Russki Power said...

thanks for this great thingy!

Improbulus said...

You're welcome RP, thanks for the comment!

Thunder Pig said...

Is there any way to search by location?

I'm trying to organize a local web ring...and just today found a Playful Primate by the same town as the web ring.

None of the other bloggers even knew the guy existed!!! His traffic is in the thousands of hits everyday...what's up with that?

Thunder Pig said...

Just read the other post. Ahem.

Maybe there's the reason we couldn't fing this guy! ;^)

Improbulus said...

OK, glad you're sorted now Thunder Pig (I think you are, anyway!)

Anonymous said...

is there a way to search for a blogspot blog using the person's email address?

Improbulus said...

Not as far as I know, Anon.

Miss Krimson said...

awesome! was looking for something like this!
new follower!
hope you can check mine out!

Vegas Discount Gifts said...

Wow this is very helpful. We are new to blogging and it is all so foreign. Thank you for making this a bit easier. Have a great day.