Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Richard Terris 273 posts 715 karma points
    Nov 11, 2012 @ 14:59
    Richard Terris
    0

    More issues with XSLTSearch

    After solving the original issues I had with XSLT Search - discovered it was a different version of Umbraco than I first thought - I still have some issues getting it up and running.

    I'm using a user control for the search box as it is to appear on every page.

    If I place the macro in the user control, and use the textbox and button contained within that I DO get results shown on the same page, so I know that the actual xslt file is working correctly.

    However, when using my own textbox and button, and setting the target page to "/search.aspx" I am not being directed to the target page.

    When I navigate to the search.aspx and enter a search term and click the button, nothing happens.

    The server form tag is on the master page but in my user control I have the following:

    <form method="post" action="search.aspx?">

    <fieldset>

    <label>

    <input class="textbox" id="search" type="text" value="" name="search" />

    </label>

    <button type="submit" value="search">Search</button>

    </fieldset>

    </form>

    I've tried the full URL http://sitename/search.aspx, I have tried search.aspx? and I have tried this as both GET and POST request but doesn't seem to work.

    I wondered if this was due to having 4 websites under the same Umbraco installation but when using the macro button and textbox the correct results are shown. I have also tried setting the source to the root node of the site I wish to search but this hasn't made a difference either.

    This is probably something simple I've missed but I'm wondering if there's any other configuration required when using multiple sites? The premise (I think) is the same as if I had multiple language sites and so I have followed instructions for that but no change.

    Any help will be much appreciated.

  • Richard Terris 273 posts 715 karma points
    Nov 11, 2012 @ 19:58
    Richard Terris
    1

    Thanks to a little chat with and some help from @mbliss I've found the solution:

    I changed the form to asp.net user controls so the form now looks like this:

    <asp:Label ID="lblsearch" runat="server" Text="Search" />

    <asp:TextBox ID="search" runat="server"/>

    <asp:Button ID="btnSearch" runat="server" Text="Search" 

        onclick="btnSearch_Click" />

    and the button click event is now:

    protected void btnSearch_Click(object sender, EventArgs e)

            {

                Response.Redirect("search.aspx?search=" + search.Text);  

              

            }

    In case anyone else has a similar issue

  • Matt Bliss 176 posts 234 karma points c-trib
    Nov 11, 2012 @ 20:32
    Matt Bliss
    1

    Great that you got it working Richard.

    P.S. You can mark your own post as the solution

Please Sign in or register to post replies

Write your reply to:

Draft