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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Form Questions /

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

search form like in the documentation site ?


Go to End


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