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 /

Site search - RequiredFields and subsites


Reply


3 Posts   1199 Views

Avatar
Carrie_Lang

Community Member, 24 Posts

2 June 2011 at 3:44am

I was reading the site search tutorial and it seem to be a peace of cake. But there's a comment "This tutorial seems to rely on .css files that are not included with SilverStripe 2.4.5, The search page and search box do not show as in the tutorial unless the user creates their own CSS." and that made me confuced. So what elements do I need to add to css to get site search to SS 2.4.5?

I tested and added the line mentioned in tutorial to config file, the site search form appeared to the header, but when I tried to move the $SearchForm to other place (other div), the form didn't appear. What files does include the codes related the site search in 2.4.5? If I want to put the search form to other div than Header do add the lines with #Header form { etc. to layout css but change the Header to the div I'm putting the form?

Avatar
Carrie_Lang

Community Member, 24 Posts

8 June 2011 at 6:25pm

Edited: 20/06/2011 6:12am

Ok, I got the form working :) But now I'm having some little question without an answer yet.

When I have subsites, how can I get the site search to search only for current subsite? Every subsite has it's own theme. I'm having a folder in the assets folder and that folder is marked to be only for one (other) subsite, so how do I make e.g. these files not to be shown in the other subsites search, as they now do.

And what and where to add to make the search form to require at least one word. Now the search can be done with the empty form as well.

Avatar
Carrie_Lang

Community Member, 24 Posts

20 June 2011 at 6:24am

I've tried to search for the right files where to add something like $validator = new RequiredFields('Search'); to make the search field required to fill. But yet I'm not sure about the right file. There are search files in sapphire/search/ so I thought there are some classes needed to copy to my Page-file to override those, but some pointers would be great.

And the subsite issue is also something without an answer yet. With Secure files the files in the other subsite are not accessable from the subsite with the sitesearch, but it would still be great if those files wouldn't appear in search result.