I used the WebPI silverstripe locally and all worked great, but when I used the other install to get my site up on my host, the search box adds the word "search" above the input field. I'm not referring to the word "search" in the input field, but just above it. How do I remove this? I did a search thru the code of the entire site and couldn't find it. Please see attached picture.
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.
That is the label on the form. Easiest way to get rid of it would be with CSS, target by ID and set display: hidden;
Unfortunately the CSS addition doesn't work, as I've tried it myself. Try this though... open up your Page.php file, and remove this string of code:
$searchText = isset($_REQUEST['Search']) ? $_REQUEST['Search'] : 'Search';
That should give you an empty search box on your site, and not affect the search function. You could also replace the word 'Search' at the end of the string above with whatever you'd like it to say as well; Enter keyword, Search here etc...
Hope this helped,
Jace
Thanks Jace. Actually when I downloaded the newest Silverstripe version and installed it, "Search" was no longer listed above the search box, so they must have fixed it between versions.
/**
* Site search form
*/
function SearchForm() {
$searchText = isset($_REQUEST['Search']) ? $_REQUEST['Search'] : 'sometext or nothing';
$fields = new FieldSet(
new TextField("Search", "", $searchText)
);
$actions = new FieldSet(
new FormAction('results', 'Search')
);
return new SearchForm($this, "SearchForm", $fields, $actions);
}
/**
* Process and render search results
*/
change to
/**
* Site search form
*/
function SearchForm() {
$searchText = isset($_REQUEST['sometext or nothing']) ? $_REQUEST['sometext or nothing'] : 'Search';
$fields = new FieldSet(
new TextField("Search", "", $searchText)
);
$actions = new FieldSet(
new FormAction('results', 'Search')
);
return new SearchForm($this, "SearchForm", $fields, $actions);
}
/**
* Process and render search results
*/