Copied to clipboard

Flag this post as spam?

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


  • Bas Schouten 135 posts 233 karma points
    Oct 14, 2009 @ 10:37
    Bas Schouten
    0

    Empty search

    Is it possible with XSLTSearch to add text when people leave the input field empty?

    I tryed to use "<xsl:when test="count($matchedNodes) = 0 or string-length($unescapedSearch)!= 0">" but this doesn't work.

    It would be great to show the text "You haven't filled any search argument, please try again".

     

     

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Oct 14, 2009 @ 13:54
    Douglas Robar
    0

    The code is pretty well commented so that should help you find the relevant portion of the code. To get you started, though, search for the following line in the name="search" template:

                <!-- display search box at the bottom of the page (the
    search box is always present even if no search was attempted) -->

    Just above that line, add the following:

                <xsl:if test="$unescapedSearch = ''">
                    <p id="xsltsearch_summary">
                        You haven't filled any search argument, please try again.
                    </p>
                </xsl:if>

    cheers,
    doug.

  • Bas Schouten 135 posts 233 karma points
    Oct 14, 2009 @ 14:06
    Bas Schouten
    0

    Thanx! It works perfect.

  • Sam 184 posts 209 karma points
    May 07, 2010 @ 21:46
    Sam
    0

    Thanks Doug, this was messing up my layout when search was pressed with no terms in it. Ended up with an extra <div> on the page. Works fine now though, thanks :)

Please Sign in or register to post replies

Write your reply to:

Draft