View Full Version : JavaScript Search Query Question

12-01-2009, 12:59 AM
I have noooo idea if I am even posting this in the correct area, let alone the correct site. If not I apologize and maybe someone could direct me elsewhere.
I am trying to add a custom search into my site.

you can see it about the middle of the page.

I am using the following script to do so.

<script type="text/javascript">
function dosearch() {
var sf=document.searchform;
var submitto = sf.sengines.options[sf.sengines.selectedIndex].value + escape(sf.searchterms.value);
window.location.href = submitto;
return false;
<form name="searchform" onSubmit="return dosearch();">
Select County
<select name="sengines">
<option value="http://www2.co.washington.mn.us/opip/mod/addresssrch/result.asp?housenum=&street=" selected>Washington</option>
<option value="http://rrinfo.co.ramsey.mn.us/public/characteristic/PropertySearchResults.aspx?pin=&Nbr=&Street=&pg=1" selected>Ramsey</option>
<option value="http://www.altavista.com/web/results?q=">Alta Vista</option>
<option value="http://www.dogpile.com/info.dogpl/search/web/">Dogpile</option>
Street Address:
<input type="text" name="searchterms">
<input type="submit" name="SearchSubmit" value="Search">

here is the problem i am running into.
I dont know how to ignore or add certain parts of the search when it sends. for example. take a look at

<option value="http://rrinfo.co.ramsey.mn.us/public/characteristic/PropertySearchResults.aspx?pin=&Nbr=&Street=&pg=1" selected>Ramsey</option>

When i try to do a search under this drop down selection it doesnt work. because it needs the &pg=1 to be added to the users search request.
Meaning if I set it to


they type in their street name and the street name inputs into the search query but it wont fully work because it doesnt add the &pg=1 after it all.

how in the world do I get it to add things like that?
ie how do i tell it to add certain strings that the outside source requires?
like blank=&blank= or how do i get it to ignore certain &blank= commands.

another example

taking a look at

<option value="http://www2.co.washington.mn.us/opip/mod/addresssrch/result.asp?housenum=&street=" selected>Washington</option>

this search function should technically be

<option value="http://www2.co.washington.mn.us/opip/mod/addresssrch/result.asp?" selected>Washington</option>

however since i dont know how to add certain functions to the search i have to skip the housenum option. that means my customers cant search by street number. I want them to be able to type in their house number and their street address and it will change to what each seperate (outside) search engine needs.

Does this make any sense at all?

Old Pedant
12-01-2009, 02:20 AM
What doesn't make sense is that the first two URLs there require that the street number and street name be in separate "fields" in the query string.


Further, both of those first two assume a particular city whereas the other two would need the city as part of the search.


I think you need to special case each one. Different JS code for each.

12-01-2009, 05:57 PM
i was assuming since each search i am sending to is slightly different I would need to setup separate functions for each site im searching out to. But i have no idea how to do that?

12-01-2009, 06:25 PM
also please ignore the dogpile and altavista searches. those will be changed to other counties. How do I go about setting up a code that either adds or hides certain search functions without user input?
And how can i setup different/seperate java search functions as you stated, but keep it in one simple window/module box?