How to set up a search form for a custom module (inc imported BC webapp)

  1. Go into a page/template on the site.
  2. At the top of content for the page you will see File Manager and Components in blue.
  3. Go to Components/custom modules and then select Search Forms
  4. Source: select Custom module you want to search
  5. Select a layout from the custom module to show the search results. List is usually best.
  6. Sort by not usually needed. Adjust if you need.
  7. Object not usually needed. Adjust if you need.
  8. There are two lots of blue code at the bottom of the screen. [[Form Code]] contains all of the fields of the custom module. Copy it and paste it on the page where you want the search fields to be. You can then edit the form to only have the fields you want to search on.
  9. The second lot of code will look like this:
    {% component source: “Boodjar Placenames”, layout: “Backup List”, isSearchResult: “true”, type: “module” %} and will show the search results. Put that in the page where you want the search results to be. It is the component tag that will render your custom module items, both initially and then after a search is submitted.
    To not display items initially you can wrap the component tag in some conditional Liquid like this:
    (from Adam Wilson)
    {% unless request.request_url.params == prop_KeyWords %}
    {% component …YOUR TAG HERE… %}
    {% endunless %}
  10. Note: you need to click on and copy these two bits of code separately and then insert them where you want the custom module search to be (template or page).

Here is another topic on how to redirect search results if you need: Custom Modules Search

4 Likes