Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Form Questions

search form like in the documentation site ?


Reply

722 Views

Avatar
snaip

23 April 2010 at 2:32am Community Member, 180 Posts

hi

how to build search form similar to this http://doc.silverstripe.org/ ?

typing some word and geting all matches topics (titles)

my code is

   function SearchForm() {

      $searchText = isset($this->Query) ? $this->Query : 'Znajdź produkt';
      $fields = new FieldSet(
       new TextField("Search", "", $searchText)
       );
      $actions = new FieldSet(
       new FormAction('results', 'szukaj')
       );

       $form = new SearchForm($this, "SearchForm", $fields, $actions);
      $form->classesToSearch(array('SiteTree'));
      return $form;
   }