Pages

Monday, 24 January 2005

Use this form to search Blogger.com 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 Blogger.com, like searching Blogger's help or searching Blogpost.com blogs, try this post!

Blogger have not provided a search facility for their profiles, yet. So here's a form to search Blogger.com 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 Blogger.com 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).

Javascript

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 Blogger.com 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 http://www.consumingexperience.com/
// licensed under Creative Commons License
//http://creativecommons.org/licenses/by-nc-sa/2.5/
//- based with thanks on code by Petra Richardson at
//http://www.js-x.com/javascript/?id=1041
//and thanks to G-BOAC of Blogger Forum for the fix
//to open results in a new window properly

function send_search()
{
var searchstring=window.document.searchengine.search.value;

if(window.document.searchengine.engine.selectedIndex == "0")
{
window.document.interests.t.value="i";
window.document.interests.q.value=searchstring;
window.document.interests.action="http://www.blogger.com/profile-find.g";
window.document.interests.target="_blank";
window.document.interests.submit()
;
}

if(window.document.searchengine.engine.selectedIndex == "1")
{
window.document.movies.t.value="m";
window.document.movies.q.value=searchstring;
window.document.movies.action="http://www.blogger.com/profile-find.g";
window.document.movies.target="_blank";
window.document.movies.submit()
;
}

if(window.document.searchengine.engine.selectedIndex == "2")
{
window.document.music.t.value="s";
window.document.music.q.value=searchstring;
window.document.music.action="http://www.blogger.com/profile-find.g";
window.document.music.target="_blank";
window.document.music.submit()
;
}

if(window.document.searchengine.engine.selectedIndex == "3")
{
window.document.books.t.value="b";
window.document.books.q.value=searchstring;
window.document.books.action="http://www.blogger.com/profile-find.g";
window.document.books.target="_blank";
window.document.books.submit()
;
}
}
</script>

<!-- below are the submission forms -->
<form name=interests action="http://www.blogger.com/profile-find.g" method="get" />
<input type="hidden" name="t" value="i" />
<input type="hidden" name="q" />
</form>

<form name=movies action="http://www.blogger.com/profile-find.g" method="get" />
<input type="hidden" name="t" value="m" />
<input type="hidden" name="q" />
</form>

<form name=music action="http://www.blogger.com/profile-find.g" method="get" />
<input type="hidden" name="t" value="s" />
<input type="hidden" name="q" />
</form>

<form name=books action="http://www.blogger.com/profile-find.g" method="get" />
<input type="hidden" name="t" value="b" />
<input type="hidden" name="q" />
</form>

<!-- 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">
<option>Interests</option>
<option>Movies</option>
<option>Music</option>
<option>Books</option>
</select>
<p>
<input type="button" value="Search profiles" name="B1" onclick="javascript:send_search()">
</p>
</form>

HTML

[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 Blogger.com profiles - results open in new window, to change this delete target="_self"
Copyright Improbulus 2005-2007 http://www.consumingexperience.com/ licensed under Creative Commons License http://creativecommons.org/licenses/by-nc-sa/2.5/
-->
<form action="http://www.blogger.com/profile-find.g" 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>
</select>
<input type="submit" value="Search" /> <input type="reset" value="Clear" />
</form>


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.

11 comments:

Anonymous Scout said...

This thing is great!

Improbulus said...

Thanks c_neil, glad you found it useful.

Magic Whale said...

thanks for this great thingy!

Improbulus said...

You're welcome RP, thanks for the comment!

Bobby Coggins 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 accident...in 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?

Bobby Coggins said...

Nevermind!!!!
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!
Maricela
vividfusion.blogspot.com

Vegas Discount Gifts & Shopping 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.