Hi guys,
I'm trying to add two search fields onto my site-one in the header and one in the footer. (To have valid HTML, I need them to have different ID tags; hence why I duplicated the code.) The search field in the header works fine, however, the one in the footer does not.
mysite/code/Page.php
class Page_Controller extends ContentController {
...
function SearchForm() {
$searchText = isset($this->Query) ? $this->Query : 'Search';
$fields = new FieldSet(
new TextField("Search", "Search", $searchText)
);
$actions = new FieldSet(
new FormAction('results', 'Search')
);
return new SearchForm($this, "SearchForm", $fields, $actions);
}
function Searchformfooter() {
$searchText = isset($this->Query) ? $this->Query : 'Search';
$fields = new FieldSet(
new TextField("SearchFooter", "Search", $searchText)
);
$actions = new FieldSet(
new FormAction('results', 'Search')
);
return new SearchForm($this, "Searchformfooter", $fields, $actions);
}
function results($data, $form){
$data = array(
'Results' => $form->getResults(),
'Query' => $form->getSearchQuery(),
'Title' => 'Search Results'
);
$this->Query = $form->getSearchQuery();
return $this->customise($data)->renderWith(array('Page_results', 'Page'));
}
...
}
Any suggestions on how to get them both working?