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.

General Questions

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

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

CustomSearchContext and SearchFields for Date range


Reply

4 Posts   1287 Views

Avatar
Terminator4

20 May 2010 at 12:11am Community Member, 81 Posts

Hi,
I would like to setup the CustomSearchContext and SearchFields for Date range using one and/or two date boxes such as "From date" and "To date" and then be able to use the innate SS functionality for searching for such a range.

Please help.

Thanks

Avatar
Enclave SSC

19 August 2010 at 9:17pm Community Member, 31 Posts

I would also love to know how to do this. I have seen WithinRangeFilter but cannot find anything on its use. Also appears incomplete. Is there anything that can be done without being to hackish?

I mean searching a single Date field for a range should be possible or at least the ability to add duplicate search context fields one for Greaterthan and one for Lessthan.

Avatar
Jedateach

11 December 2010 at 11:07am (Last edited: 11 December 2010 11:07am), Forum Moderator, 227 Posts

+1 for seeing the WithinDateRange filter and field working.

..further to Enclave's suggestion I can imagine the SearchFilter form system allowing you to choose either:
search value,
search between,
search greater than,
search less than

ie allowing the user to customize how the search is done on the form, and the form will modify itself appropriately, such as showing two input boxes for searching between values.

..this should be made into a trac ticket, or discussed on the ss google dev group to actually see / hear about any progress.

Avatar
swaiba

11 December 2010 at 9:17pm Forum Moderator, 1796 Posts

Sorry for my ignorance, but are you guys talking...
* searching the site
*forms
*model admin?

I'm adding this to model admin soon, I don't see a problem in doing so...