We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6562
    • 37 Posts
    How would I accomplish the following:

    I’d like to put a search box on every page, but without the Ajax behavior... basically just an input field
    with a ’search’ submit button that passes its value to a new page that will have the search results.


    Darkelve78

      • 29076
      • 615 Posts
      You find it all in the readme-file. wink

      &ajaxSearch [1 | 0] (optional)
              Use the ajaxSearch mode. Default is 1 (true)
              The AjaxSearch mode use an Ajax call to get the results without full page reloading

      See the Wiki also. (Not for 1.8.0 but very up to date on the basics).

        I think, thererfor I am! But what I am, and why...?
        • 6562
        • 37 Posts
        Yeah, I found that already. I guess my real question is, if I create a page containing an AjaxSearch ’noninteractive’ call, then how do pass the parameter from one page (input field) to the other (AjaxSearch)?

        I want the search box on all pages, but the results to show in a new page.

        Edit: Woops! I found out how to do it... in the example code, I gave in an existing page id for the example, so it looked like no new page was being opened... x)

        It works now, but I get the search result 2 times if I do it like in the documentation? But it does work as expected when I just use an ’empty’ page as a landingpage. Does need a new template though smiley
          • 29076
          • 615 Posts
          You don’t need another template for the landing-document (the document to show the search result).

          For example, put
          [!AjaxSearch? &ajaxSearch=`0` &depth=`5` &AS_showResults=`0` &AS_landing=`IDofYourLandingDocument` &extract=`0` &grabMax=`all` !]

          in your template to gt the search box on all your pages.

          Then put i.e.
          [!AjaxSearch? &ajaxSearch=`0` &AS_showForm=`0` &depth=`5` &addJscript=`1` &extract=`0` &grabMax=`50` &AS_showResults=`1` !]

          in your landing document.

          This way the only place you get the search results is in your landing document. With the same template as all your other documents.  smiley
            I think, thererfor I am! But what I am, and why...?
            • 7231
            • 4,205 Posts
            When I develop I usually create a couple of text TVs and place them before and after the content placeholder in the template. The I assign these TVs to a private manager group so that I can issolate them from other managers. Then I use these for adding elements to a page that I don’t want the normal managers to edit, like specifi calls to stuff like ajaxsearch or ditto or anything that I want to add that is not to be edited. Beats having to create a new template.

            Ends up looking like this in the template:
            [*pre_content*]
            [*content*]
            [*post_content*]

            This really helps to keep snippet calls away from the clients reach grin
              [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]
              • 6562
              • 37 Posts
              @Sylvaticus: thanks, this is what I was looking for!

              @dev_cw : great advice grin