PassMark Logo
Home » Forum

Announcement

Collapse
No announcement yet.

Search box frustrations - adding search form on ASP.NET page

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

  • Search box frustrations - adding search form on ASP.NET page

    I just purchased Zoom as it came highly recommended by some folks I highly respect. I've decided to use the ASP version within my ASP.NET site, as it is on shared hosting and getting permissions set etc. is a pain.

    I have a working search page here: http://sisco.ztechsystems.net/search.asp and when I enter something in the search box, the results appear as expected.

    In order to get a search box on every (other) page, I added code to my site's master page as explained in the Wrensoft FAQ's. The actual code I added is:
    Code:
    <form method="get" action="http://sisco.ztechsystems.net/search.asp">
    <input type="text" name="zoom_query" size="15" />
    <input type="submit" value="Search" />
    </form>
    I get a beautiful search box on every page as expected, but when test, the page refreshes without going to the search.asp page. What have I done wrong???


    ~ Bruce

  • #2
    The problem is that ASPX messes up the page.

    For some reason that no one as been able to explain to us as yet, every ASPX page contains a form which encompasses the entire page. If you look in your code you will find this at the top of your page,

    Code:
     
    <form name="aspnetForm" method="post" action="Default.aspx" id="aspnetForm">
    So what you have done is to add a form within a form. That is to say, nested double forms. But nested forms are not valid HTML, at least as far as IE is concerned, and so the whole thing fails.

    In fact this multiple forms problem is a common ASPX problem, and there are Open source solutions to try and work around it and allow .NET to use a form. All this seems pretty silly to us, as .NET was surpose to make development easier, not four times more complicated.

    We'll have a poke around today the Net to see if there is a better way to add a form to a ASP.NET page. It should be easy.....

    Comment


    • #3
      Thanks, Wrensoft! I appreciate your taking a look about, and hope you can quickly provide a solution.

      At this point, I'm so frustrated that I'm thinking about asking for a refund! I don't think that the Wrensoft advertising should indicate that they support ASP.NET... I tried using the CGI approach, and even after my host pronounced Zoom as safe, and set the proper permissions on my account, I couldn't get things to work. And after seeing some of the rather dismissive responses to others unable to get things to work in ASP.NET........... I'm certainly not alone. While the program is certainly functional, it does not deal well with the .NET world, and the instructions are inadequate.

      I appreciate that we ALL want EVERY client, but if your software really doesn't play nice in .NET except under favorable moon signs, you really should be honest and up-front about that and save folks from wasting DAYS of development time when your tool isn't up to the task. As you said, Wrensoft... "it should be easy"!

      Comment


      • #4
        While I can understand your frustration, I should point out that the problem you are having here, specifically with the difficulty of adding a search box to your ASPX pages, is a well recognized and known limitation of ASP.NET - it is not limited to Zoom.

        The same problem is inherent if you wish to add a Google search box to your ASPX page, or indeed any HTML form to an external script or site which is not an ASP.NET control installed on your site. Some examples of the same problem when used with other sites/scripts can be seen here and here.

        The "ASP.NET way" is to create the form on your masterpage, so that it can appear before the runat="server" form. This is the known and recommended way to implement multiple forms on an ASPX page, and is essentially an ASPX design rule (actually, there are other ways which are much much more complex, see Microsoft's article here). We could update our documentation with some examples on this but we're not too happy with this solution as it seems too dependent on the context of your site being compatible. It is difficult to explain outside of the context of an existing website, and .NET developers are clearly not too familiar with it being necessary, seeing your post and others here. We're investigating an alternative method which uses a Javascript search form, which we should be posting here soon with clear instructions and examples which will allow you to add your search box anywhere on your website.

        And yes, I agree that there is room for improvement with making things easier to integrate with ASP.NET sites, and as the ASP.NET user base grows, this has become an increasingly significant priority for us.

        More to come soon...
        Last edited by Ray; Jun-21-2007, 05:05 AM.
        --Ray
        Wrensoft Web Software
        Sydney, Australia
        Zoom Search Engine

        Comment


        • #5
          OK, I think we've got a solution.

          Instead of this search box HTML you mentioned above:

          Code:
          <form method="get" action="[B]http://sisco.ztechsystems.net/search.asp[/B]">
          <input type="text" name="zoom_query" size="15" />
          <input type="submit" value="Search" />
          </form>
          Replace this with the following:

          Code:
          <input type="text" name="zoom_query" size="15" />
          <input type="button" value="Search"
          onClick="window.location='[B]http://sisco.ztechsystems.net/search.asp[/B]?zoom_query=' + this.form.zoom_query.value" >
          That's right, there's no <form> ... </form> tag needed because it is already within a form in ASP.NET. What this does is it uses Javascript with the "onClick" event to pass the variable to the "search.asp" page as needed. We'll update our documentation with some info on this.

          Let us know if you have any trouble with it but it seems to work OK in our testing.
          Last edited by Ray; Jun-21-2007, 05:20 AM.
          --Ray
          Wrensoft Web Software
          Sydney, Australia
          Zoom Search Engine

          Comment


          • #6
            Thanks!!!

            Thank you, Raymond! You've now got a happy and satisfied customer who actually learned a little something about ASP.NET as well! Your solution works beautifully.

            Thank you very much for the prompt action!!!

            ~ Bruce

            Comment


            • #7
              Your solution worked wonderfully! THANK YOU!

              Comment


              • #8
                Zoom Search forms on ASP.Net pages - a solution

                I ran into this problem today and used this solution, which seems to work fine...

                Apparently the form which encloses every asp.net page is only required around the asp.net portion of the page, i.e. controls declaring runat="server".

                If the Zoom search forms are at the top and/or bottom of the page, and don't include asp.net controls, they can apparently go outside the asp.net form and work fine:
                BODY
                ZOOM Form start
                ZOOM Form end

                ASP.NET Form (runat="server") start
                -- the asp.net page --
                ASP.NET Form end

                ZOOM Form start
                ZOOM Form end
                BODY
                There can be only one asp.net form, but one or more other forms, with no forms enclosing others.

                Comment


                • #9
                  This piece of code works fine
                  Code:
                   <input type="text" name="zoom_query" size="15" />
                  <input type="button" value="Search"
                  onClick="window.location='http://sisco.ztechsystems.net/search.asp?zoom_query=' + this.form.zoom_query.value" >
                  How does it work with input type="image" src="../images/global/btn_search.gif" ?

                  We have tried:

                  Code:
                  <input type="image" value="Search" src="../images/global/btn_search.gif" onClick="window.location='http://ourwebsite.edu/search.asp?zoom_query=' + this.form.zoom_query.value" >
                  But it did not work. Please help.

                  Comment


                  • #10
                    Most browsers don't support an onClick attribute for an input type="image" tag from what I can tell.

                    Instead, you can use an input type="button" tag, but use CSS or the "style" attribute to modify its appearance such that it is rendered as an image button.

                    You can find some examples of using CSS to style a submit button so that it appears as an image button here:
                    http://www.wrensoft.com/zoom/support/searchbox.html

                    Note that for the examples in the linked support page, they're using <input type="submit" ...> tags. Just make sure you are using <input type="button" ...> tags, but similar style="..." properties and you should be able to make your button into an image.

                    Hope that helps.

                    As an aside: we're working on V7 of Zoom, which will support PostBacks in ASP.NET.
                    --Ray
                    Wrensoft Web Software
                    Sydney, Australia
                    Zoom Search Engine

                    Comment


                    • #11
                      Thanks Ray. Actually, I wrote a little js for an onClick attribute.... Cannot blame Friday Anyway, your examples work great.

                      Comment

                      Working...
                      X