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 /

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

search form like in the documentation site ?


Go to End
Reply


773 Views

Avatar
snaip

Community Member, 180 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;
	}