Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Nov 2009
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    JavaScript Search Query Question

    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.

    http://www.jeffknowsloans.com
    you can see it about the middle of the page.

    I am using the following script to do so.

    Code:
    <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;
    }
    </script>
    <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>
    </select>
    Street Address:
    <input type="text" name="searchterms">
    <input type="submit" name="SearchSubmit" value="Search">
    </form>
    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

    Code:
    <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
    Code:
    http://rrinfo.co.ramsey.mn.us/public/characteristic/PropertySearchResults.aspx?pin=&Nbr=&Street=
    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

    Code:
    <option value="http://www2.co.washington.mn.us/opip/mod/addresssrch/result.asp?housenum=&street=" selected>Washington</option>
    this search function should technically be
    Code:
    <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?

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    26,027
    Thanks
    79
    Thanked 4,436 Times in 4,401 Posts
    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.
    Code:
    result.asp?housenum=&street=
    PropertySearchResults.aspx?pin=&Nbr=&Street=&pg=1
    Further, both of those first two assume a particular city whereas the other two would need the city as part of the search.

    So...

    I think you need to special case each one. Different JS code for each.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #3
    New to the CF scene
    Join Date
    Nov 2009
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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?

  • #4
    New to the CF scene
    Join Date
    Nov 2009
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •