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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Search box - remove "search" above box


Go to End


5 Posts   2382 Views

Avatar
Valorinbattle

Community Member, 95 Posts

20 November 2009 at 11:05am

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.

Attached Files
Avatar
dalesaurus

Community Member, 283 Posts

26 November 2009 at 4:53am

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;

Avatar
Jace

Community Member, 1 Post

21 January 2010 at 9:03am

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

Avatar
Valorinbattle

Community Member, 95 Posts

21 January 2010 at 5:56pm

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.

Avatar
Webdoc

Community Member, 349 Posts

21 January 2010 at 6:29pm

/**
* 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
*/