We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 48586
    • 78 Posts
    I have my snippet set up in a chunk like:

    [[!SimpleSearchForm? &landing=`1333`]]


    For example, if I search the term "storm", my URL looks like:

    http://www.example.com/?search=storm&id=1333


    So, it is taking my landing value and setting it as id, not sure if that is the issue and how to get around it, but, when I manually add the resource alias for document 1333 I get the correct result for my search:

    http://www.example.com/search-results?search=storm&id=1333


    Any ideas what I am doing wrong here?

    Thank you very much

    This question has been answered by donshakespeare. See the first response.

    [ed. note: rjohnson375 last edited this post 8 years, 8 months ago.]
    • discuss.answer
      • 42562
      • 1,145 Posts
      First, I do not even know what the landing page is doing in the url.

      This is my simpleSearchFormTpl TPL
      <form action="[[~[[+landing:default=`[[*id]]`]]]]#search" method="[[+method:default=`get`]]">
       <input id="searchField" type="text" name="[[+searchIndex]]" value="[[+searchValue]]" placeholder="Type to Search" />
       <input type="hidden" value="[[+landing:default=[[*id]]]]" />
      </form>

      Does yours look too dissimilar?

      Observe the form action url
        TinymceWrapper: Complete back/frontend content solution.
        Harden your MODX site by passwording your three main folders: core, manager, connectors and renaming your assets (thank me later!)
        5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.
      • Here's the one I use for a flex-based navbar search field
        The snippet:
        [[!SimpleSearchForm? &landing=`7` &tpl=`searchFormTpl`]]
        

        The searchFormTpl - note the hidden field with the landing:

        <form action="[[~[[+landing:default=`[[*id]]`]]]]" method="[[+method:default=`get`]]" class="flexy-nav_form">
          <input class="flexy-nav_search" type="text" name="simpleSearchField" placeholder="Type search terms and hit enter...">
          <input type="hidden" name="id" value="[[+landing:default=[[*id]]]]" />
        </form>

        And the snippet on the landing page:
        [[!SimpleSearch? &searchIndex=`simpleSearchField`]]

        It does in fact put the landing page ID in the URL:
        http://domain.com/search-results.html?simpleSearchField=deserunt&id=7
          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
          • 48586
          • 78 Posts
          Thank you both, there must have been something funky with my tpl file, the chunk is now working and directing people to the correct landing page. Now I just have to make that page look good and play with some other parameters. Thank you both very much.