Jump to:

23490 Posts in 18996 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » Search function doesn't work

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 438 Views
  • alienn
    Avatar
    Community Member
    15 Posts

    Search function doesn't work Link to this post

    Hi there
    i'm creating search function to my simple site and.. no good.

    i did everything like the tutorial and it seems that silvestripe ignores it.
    First, search form displays

    <form id="SearchForm_SearchForm" action="/profil/SearchForm" method="get" enctype="application/x-www-form-urlencoded">


    but i think it should be action="/results", because when i click id redirect me to that page (or similar like /something/SearchForm) and page just refresh, no search content it's displayed.
    I've created results() function in Page_Controller, created Page_results.ss - everything what's on the tutorial, and still nothing.
    I've just followed tutorial strictly, maybe i need to tweak it a little, but for now i'm stuck.

    Someone can help me with this?

  • Willr
    Avatar
    Forum Moderator
    5508 Posts

    Re: Search function doesn't work Link to this post

    but i think it should be action="/results"

    Nope, the form action goes to your controller which then redirects you after it's finished processing to the results uri. You shouldn't need to include any PHP code as that is all built in as of 2.4/3.0 though make sure your theme has a Page_results.ss template that outputs the results.

  • alienn
    Avatar
    Community Member
    15 Posts

    Re: Search function doesn't work Link to this post

    ok thanks.
    however its not working either.
    clicking search button redirects me to "test.local/profile/SearchForm?Search=search&action_results=Ok"
    and normal page is displayed, nothing more

  • alienn
    Avatar
    Community Member
    15 Posts

    Re: Search function doesn't work Link to this post

    no one, really?

  • simon_w
    Avatar
    Forum Moderator
    473 Posts

    Re: Search function doesn't work Link to this post

    Do you have a Page_results template, as per the tutorial?

    438 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.