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.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Form Questions /

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

search form like in the documentation site ?


Go to End


955 Views

Avatar
snaip

Community Member, 181 Posts

23 April 2010 at 2:32am

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;
	}