We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23307
    • 5 Posts
    I would like to implement search option on my website, I tired AJAX search but it displays results on same page, I have search box at top and would like to display search on specific page.

    I also tried HyperFlexSearchForm, but when I use it in my template it does not show me any search form ?
    Do I need to create search form by myself or it creates like ajaxserach ?
    How can I show search results on different page with paging?



      • 7231
      • 4,205 Posts
      With ajaxsearch you can force it to go to a result page by using the:

      &AS_landing [int] (optional)
      Document id you would like the search to show on. (For non-ajax search)
      
      &ajaxSearch [1 | 0] (optional)
      Use the ajaxSearch. Default is 1 (true)


      All the parameters are in the begining of the snippet. You need to have a ajaxsearch call on the result page as well.
        [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

        Something is happening here, but you don't know what it is.
        Do you, Mr. Jones? - [bob dylan]
        • 23307
        • 5 Posts
        yes i tried this

        :[!AjaxSearch?&ajaxSearch=’0’&AS_landing=’40’!]

        but it does not seem working, it worked once but again now it is not working, showing results on same page, and even that also sometimes does not show any results and sometimes it does, is it ’cache’ problem? how can i avaoid this?
          • 11975
          • 2,542 Posts
          Hi,

          use backticks instead of simple quote

          [!AjaxSearch?&ajaxSearch=’0’&AS_landing=’40’!]

          [!AjaxSearch?&ajaxSearch=`0`&AS_landing=`40`!]

          :-)
            Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
            • 23307
            • 5 Posts
            thanks for your reply, i did not know that we have to use backticks? what does it make difference? and also it is submmiting to my page now properly but still shows results on top (Where the serach box is), i want serach result to be display on document (with Id 40)
              • 7231
              • 4,205 Posts
              Backticks ` is just the way it is, I guess it is because ’ are used in php for other stuff. To turn off the results you need to also add the &AS_showResults=`0` parameter. Here is a sample call:

              [!AjaxSearch? &ajaxSearch=`0` &AS_showForm=`1` &AS_landing=`40` &AS_showResults=`0`!]


              then on document 40 you also need to add a call:
              [!AjaxSearch? &ajaxSearch=`0` &AS_showForm=`1` &AS_landing=`62` &AS_showResults=`1` &extract=`1` &grabMax=`20`!]


              If you don’t want to include a search form use &AS_showForm=`0`.
                [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                Something is happening here, but you don't know what it is.
                Do you, Mr. Jones? - [bob dylan]
                • 23307
                • 5 Posts
                Thank you very much, it worked, i wonder why we need call on landing page, without it, it is not showing results?
                  • 28042 ☆ A M B ☆
                  • 24,524 Posts
                  The original search page redirects to the "landing" page. How would the landing page know what it’s supposed to do without a corresponding snippet call?
                    Studying MODX in the desert - http://sottwell.com
                    Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                    Join the Slack Community - http://modx.org