Copied to clipboard

Flag this post as spam?

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


  • Carlo Cabrales 58 posts 77 karma points
    Aug 30, 2010 @ 18:15
    Carlo Cabrales
    0

    search bar on the master page

    I installed this package and it created a search node with the search bar on it..

    Is there a way I can use this package so I can use it to place the search bar as a macro on my master page? 

  • Jamie Howarth 306 posts 773 karma points c-trib
    Aug 30, 2010 @ 18:24
    Jamie Howarth
    0

    Hi Carlo,

    I'm making a custom usercontrol to do this as there is no way of using the XSLTsearch macro itself just to show a single search bar on another page.

    Best,

    Benjamin

  • Carlo Cabrales 58 posts 77 karma points
    Aug 30, 2010 @ 18:27
    Carlo Cabrales
    0

    Benjamin,

    Is this something you'll share? 

    I'm sure the Umbraco beginners (me) would love this

  • Jamie Howarth 306 posts 773 karma points c-trib
    Aug 30, 2010 @ 18:31
    Jamie Howarth
    0

    Hi Carlo,

    I'll ask Doug if he'd consider adding it to the XSLTsearch package, otherwise I'll make the code available on my blog (once it's up and running).

    Best,

    Benjamin

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Aug 30, 2010 @ 19:02
    Douglas Robar
    1

    I'm not quite sure what you mean, Carlo.

    You can make your own <form> in your master template and set the action="" to your search page. Just be sure the search field has a name/id of "search" and XSLTsearch will pick up what you typed in. You can use either a GET or POST method in your form and XSLTsearch will just work.

    If you want to stop XSLTsearch from displaying its own search form on the search/results page you only need to set the XSLTsearch macro property to "NONE". All the macro properties are fully detailed in the PDF docs.

    This is exactly what I do on my blog, for instance... search field in master template and disable the built-in search field in the XSLTsearch macro itself. You can see an example at http://blog.percipientstudios.com

    Of course, if you have a form tag on your master template that surrounds the search field you may have some difficulty because that will cause a form tag to appear inside a form tag, which isn't allowed. That's a problem with asp.net generally, not XSLTsearch.

     

    Anyway, let me know what you're trying to accomplish in more detail and I'm sure we can get it sorted out for you.

    cheers,
    doug.

  • Jamie Howarth 306 posts 773 karma points c-trib
    Aug 30, 2010 @ 19:07
    Jamie Howarth
    0

    Hey Doug,

    Carlo and I are trying to achieve the same thing, which is what you're doing on your blog - turning off the search boxes in XSLTsearch's macro and creating an input in the master template which then redirects to the XSLTsearch page.

    I'm doing it with a .NET usercontrol and a rewired master template, because my master templates have <form> tags in them and need to have them there for every page, so to get this to work with XSLTsearch I have to create a new master template and remove a batch of usercontrols.

    Best,

    Benjamin

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Aug 30, 2010 @ 19:11
    Douglas Robar
    1

    That's right, if your design forces you to have the <form runat=server> tag around the search textbox then you'll need to have a small user control.

    I think Warren had that problem with his CWS2 package and includes a simple usercontrol to resolve the issue. Take a look at his solution, as I recall it is quite generic and would work for anyone.

    cheers,
    doug.

  • Jamie Howarth 306 posts 773 karma points c-trib
    Aug 30, 2010 @ 19:12
    Jamie Howarth
    0

    Thanks Doug, sounds sweet, I'll check it out :-)

  • Carlo Cabrales 58 posts 77 karma points
    Aug 31, 2010 @ 19:18
    Carlo Cabrales
    0

    Doug what you're trying to describe is what I'm trying to accomplish.

    I posted this in my masterpage and now I have a working search box! Thank you

    <form action="/search.aspx" method="get">
      <div class="xsltsearch">
        <input name="search" type="text" class="input" value="" />
        <input type="submit" value="Search" class="submit" />
      </
    div>
    </
    form>

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Aug 31, 2010 @ 20:29
    Douglas Robar
    0

    Excellent! Glad you got it working, and thanks for posting the solution.

    cheers,
    doug.

  • Owen Hope 119 posts 140 karma points
    Dec 24, 2010 @ 18:57
    Owen Hope
    0

    Hi Douglas/Carlo

    I am trying to do the same thing that you have done by posting:

     <form action="/search.aspx" method="get">
      <div class="xsltsearch">
            <input name="search" type="text" class="input"/>
                    <input type="submit" value="Search" class="submit" />
      </div>
     </form>

    onto my Master Template.

     

    The page correctly directs to Search.aspx but search itself seems to not be working.

    However if I choose:

    <form runat="server">
      <div class="xsltsearch">
            <input name="search" type="text" class="input"/>
            <input type="submit" value="Search" class="submit" />
       </div>
    </form>

     

    I get the proper search results but they just dump onto the page (which doesn't work for me).

     

    Any help or direction would be much appreciated!

     

    Owen

     

     

     

     

  • Carlo Cabrales 58 posts 77 karma points
    Dec 27, 2010 @ 13:34
    Carlo Cabrales
    0

    Can you copy and paste your full html? 

    Make sure you don't have nested form tags. 

              <form class="right" id="searchDesign" action="/search.aspx" method="get"><input name="search" type="text" class="text" value="" /> <input type="submit" value="Search" class="button" /><!--<input name="search" text="" class="text" /> <input type="submit" value="Search" class="button" />--></form>
               <div class="left" id="logo"
                          <href="/"><img src="/css/images/crestlogo.png" alt="Homepage"/></a>
               </div
     
          <div class="left navigation" id="main-nav"
                      <umbraco:Macro Alias="RunwayDropdownNavigation" runat="server" />
                    <div class="clearer">&nbsp;</div
     
          </div
     
          <div class="clearer">&nbsp;</div
     
        </div
        
      </div
     
            <form id="RunwayMasterForm" runat="server">
              <asp:ContentPlaceHolder ID="RunwayMasterContentPlaceHolder" runat="server"></asp:ContentPlaceHolder>
            </form>

    This is a snippet from my masterpage. The search is on its own node -- hidden. The form tags aren't nested. 

    Hope this helps.

  • Owen Hope 119 posts 140 karma points
    Jan 03, 2011 @ 20:00
    Owen Hope
    0

    Hi Carlo,

    Thanks for your help, I ended up having a problem with my permissions on my Usercontrols folder...very frustrating!

    Thanks again,

    Owen

     

     

     

  • Jeff Turner 1 post 21 karma points
    Oct 30, 2011 @ 14:48
    Jeff Turner
    0

    I was able to get around the nested form issue using javascript.

     

    <input type="button" id="searchbutton" class="submit" onclick="parent.location='/search.aspx?search=' + window.document.getElementById('searchbox').value" value="" />
                          

  • Jon Boyer 37 posts 59 karma points
    Jan 23, 2012 @ 04:11
    Jon Boyer
    0

    It's also quite common to have your searchbar near the top of your page, so you could put the searchform code before you start your runat server form, i.e.

     

    <formclass="right"id="searchDesign"action="/search.aspx"method="get"><inputname="search"type="text"class="text"value=""/><inputtype="submit"value="Search"class="button"/></form>

     

    <form runat="server">

     

    Everything else

     

    </form>


             

  • plindgren 2 posts 22 karma points
    Sep 23, 2012 @ 15:16
    plindgren
    0

    How would you customize the searchbar and button?

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Sep 23, 2012 @ 18:47
    Jan Skovgaard
    0

    Hi Plindgren

    By customizing are you then thinking in terms of layout or in terms of functionality?

    If you're thinking about how to customize the desgin of the form elements then you can use the id's of each elemen to add some custom css.

    But please ellaborate a bit more on what it is you intend to do so we can provide some better answers for you :)

    /Jan

Please Sign in or register to post replies

Write your reply to:

Draft