PassMark Logo
Home » Forum

Announcement

Collapse
No announcement yet.

So close! CGI with .NET wrapper form population

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • So close! CGI with .NET wrapper form population

    Greetings:

    Just purchased the Enterprise version and have almost got everything working but have hit a small snag, due to my lack of JavaScript chops. Maybe someone here can help.

    Here's the deal. We opted for the CGI version for performance reasons and had to integrate the search page into our asp.net based CMS (umbraco). So I wrote an ascx user control to wrap the CGI and embedded it in our page template in the CMS. Next, because I was running against the dreaded asp.net form issue, I had to tell Zoom not to generate a search form. I copied the old form generated on a previous test run and pasted it into my search template, without the form tags. Then I added the JavaScript code to embed the zoom_query into the request string and submit the form since the master asp.net form uses post rather than get. So far, everything I have done has been thanks to some great finds here on this site. And it all works. Except that I am using the categories check boxes and the any/all terms radio buttons -- and I can't figure out how to pass those values in the search string.

    Here's what I have for my submit button:

    Code:
    <input name="zoom_submit_custom" type="button" value="Search" class="zoom_button" 
    onClick="window.location='http://www.fcps.net/tools/zoom-search-result?zoom_query=' 
    + this.form.zoom_query.value + '&zoom_cat=' + this.form.zoom_cat.value 
    + '&zoom_and=' + this.form.zoom_and.value" />
    I just tried using the same method on the check boxes and radio buttons as on teh text box, but that is not working. Hopefully someone with better JS skills can straighten this out for me?

    BTW -- Zoom rocks. I can't wait to roll this out on our new site.
    ------------------------------------------------
    Pete Koutoulas • Fayette County Public Schools • Lexington, KY

  • #2
    There are many different ways to do this, but here's something relatively simple.

    I thought it'd be neater to have the code as functions, so you'd need the following specified in <script> ... </script> tags (usually near the top of the page or in the <head>):

    Code:
    <script language="JavaScript">
    function getCatParams(form)
    {
        var catParams = "";
        var list = form.elements["zoom_cat[]"];
        for (var i=0; i < list.length; i++)
        {
            if (list[i].checked)
                catParams = catParams + "&zoom_cat[]=" + list[i].value;
        }
        return catParams;
    }
     
    function getMatchParams(form)
    { 
        var list = form.elements["zoom_and"];
        for (var i=0; i < list.length; i++)
        {
            if (list[i].checked)
                return "&zoom_and=" + list[i].value;
        }
    }
    </script>
    And then the actual onClick action would look like this:

    Code:
    <input type="button" value="Search" onClick="window.location='http://holly/raytest/dnn/search.php?zoom_query=' + this.form.zoom_query.value + getMatchParams(this.form) + getCatParams(this.form);" >
    You could probably write one single function to do this for any checkboxes if you wanted, but that's just something quick to hand.
    --Ray
    Wrensoft Web Software
    Sydney, Australia
    Zoom Search Engine

    Comment


    • #3
      Thanks!

      Raymond, that worked beautifully! Thanks so much for the quick response.
      ------------------------------------------------
      Pete Koutoulas • Fayette County Public Schools • Lexington, KY

      Comment

      Working...
      X