We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24904
    • 79 Posts
    mydomain.com/public/assets/snippets/ajaxSearch/templates/layout.tpl.html
    [+as.showForm:is=`1`:then=`
            <div id="HeaderContainer_search">
                <div id="HeaderContainer_client_login">
                    <a href="client-login.html"><img src="http://www.mydomain.com/public/assets/templates/mytemplate/images/login.gif" alt="Login" width="103" height="23" border="0" /></a>            
                </div>
    
                <div id="HeaderContainer_searchbox">
                    <form [+as.formId+] action="[+as.formAction+]" method="post">
                    	<input type="hidden" name="advSearch" value="[+as.advSearch+]" />
                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
                            <tr>
                                <td align="right" class="search">Search:</td>
                                <td width="195" align="right"><input id="ajaxSearch_input" name="search" type="text" class="SearchBasicInputBox" value="[+as.inputValue+]"[+as.inputOptions+] /></td>
                                <td width="40" align="right"><input id="ajaxSearch_submit" type="image" name="sub" value="[+as.submitText+]" src="http://www.mydomain.com/public/assets/templates/mytemplate/images/btn_search.gif" alt="Go" /></td>
                            </tr>
    
                        </table>
                    </form>
                </div>
            </div>
    
    
    `+]
    [+as.showResults:is=`1`:then=`
    [+as.results+]
    `+]


    Search box call is on top of the template page, (ie in the header (A) - see below)
    [!AjaxSearch? &ajaxSearch=`0` &AS_landing=`30` &extract=`1`!]


    Search Result Page has this call in the content body (Z) - see below.
    [!AjaxSearch? &ajaxSearch=`0` &AS_showForm=`0`!]



    Normal Page layout
    ***************************
    Header (A) <--- search box is here
    ***************************
    navigation menu (B)
    ***************************
    Content Body (C)
    ***************************
    Footer (D)
    ***************************

    Search Result Page layout // page id = 30
    ***************************
    Header (A) <--- search box is here
    ***************************
    navigation menu (B)
    ***************************
    Content Body (Z) <--- only want results to display here!
    ***************************
    Footer (D)
    ***************************

    The problem:
    -Only would like the results to show on the result page via this call [!AjaxSearch? &ajaxSearch=`0` &AS_showForm=`0`!]

    But what happens right now?,
    User searchs, modx redirects user to search result page, results are shown twice on the results page!
    at location A, and Z.
    @A with this call [!AjaxSearch? &ajaxSearch=`0` &AS_landing=`30` &extract=`1`!]
    @Z with this call [!AjaxSearch? &ajaxSearch=`0` &AS_showForm=`0`!]

    how can I make the results show on the result page only at location Z only?

    Note: Search box is displayed on every page, i.e its in the template!
      • 19726
      • 239 Posts
      Sounds like you want to set the &AS_showResults =`0` option on the call that generates the searchbox.
      See the docs http://wiki.modxcms.com/index.php/AjaxSearch
        • 24904
        • 79 Posts
        Quote from: Mitch at Oct 10, 2008, 05:45 AM

        Sounds like you want to set the &AS_showResults =`0` option on the call that generates the searchbox.
        See the docs http://wiki.modxcms.com/index.php/AjaxSearch

        That fixed it!!
        thanks ALOT!