I wonder if anyone might be able to point me in the right direction in customising a Calendar Events Search Page (CESP) please?
Here’s what I have:
On this page I have a CESP that allows users to search for archived meetings by year. So far I have done the following:
- set an initial search on the Search Fields settings page - creating an Events Date Filter Configuration called startdate, filtering by a [b]Date Range[/b]
[*]displayed links to the meetings that have taken place in the current year by setting the [b]Show the Results page[/b] option on the Details page to [b]Yes[/b], and where I nest the CESP, sending the GET variable '[b]startdate[/b]' to the asset with value [b]01-01-%globals_date_Y%,%globals_date_d%-%globals_date_m%-%globals_date_Y%[/b]
[*]I have then looked at setting up the option for users to select the year, and since I only want users to select from the years, I have hard coded the search fields as follows:
<code>
<script type='text/javascript'>
$(function() {
$('#startdateFromYear').change(function() {
// if changed to, for example, the last option, then
// $(this).find('option:selected').text() == D
// $(this).val() == 4
// get whatever value you want into a variable
var x = $(this).val();
// and update the hidden input's value
$('#startdateToYear').val(x);
});
});
</script>
Select year:
<input type="hidden" name="queries_startdate_fquery_fromshow" value="ymd" />
<input type="hidden" name="queries_startdate_fquery_fromvalue[d]" id="queries_startdate_fquery_fromvalue[d]" value="1" />
<input type="hidden" name="queries_startdate_fquery_fromvalue[m]" id="queries_startdate_fquery_fromvalue[m]" value="1" />
<select name="queries_startdate_fquery_fromvalue[y]" id="startdateFromYear" class="sq-form-field">
<option value="2010">2010</option>
<option value="2011">2011</option>
<option value="2012">2012</option>
</select>
<input type="hidden" name="queries_startdate_fquery_fromvalue[h]" value="" />
<input type="hidden" name="queries_startdate_fquery_fromvalue[i]" value="" />
<input type="hidden" name="queries_startdate_fquery_fromvalue[s]" value="" />
<input type="hidden" name="queries_startdate_fquery_toshow" value="ymd" />
<input type="hidden" name="queries_startdate_fquery_tovalue[d]" id="queries_startdate_fquery_tovalue[d]" value="31" />
<input type="hidden" name="queries_startdate_fquery_tovalue[m]" id="queries_startdate_fquery_tovalue[m]" value="12" />
<input type="hidden" name="queries_startdate_fquery_tovalue[y]" id="startdateToYear" value="" />
<input type="hidden" name="queries_startdate_fquery_tovalue[h]" value="" />
<input type="hidden" name="queries_startdate_fquery_tovalue[i]" value="" />
<input type="hidden" name="queries_startdate_fquery_tovalue[s]" value="" />
%submit_button%
</code>
[*]As you will see, the inputs for days and months are set to the 1st Jan for the from date and 31 December for the to date. The javascript sets the to year to be the same as the from date, so the actual search looks for events from the 1 Jan to the 31 Dec in the chosen year.
Here's what I'd like to do (and could do with a pointer or two please!)[list]
[*]Include a subtitle above the results, something like [b]Meetings from [year][/b] - where [year] is the year that the user has searched for.
I did manage to do this when there were results found by using a grouping and displaying the group name, but that didn't work when there were no results.
Another thought I had was to use the keyword %<field_name>_query_terms%, but no matter what I entered for <field_name> (I tried [b]startdate[/b] and also [b]queries_startdate_fquery_fromvalue[y][/b]), nothing displayed on either the Results Page Layout or the No Results Page Layout. I suspect it is because I have hard coded the search inputs.
[*]Make the drop down box for the user to select the year to search on auto-fill from the start dates of the events that are available to search on.
I am not really sure how to go about this - I guess by having another search and somehow filtering the results of it to find the date of the earliest one in the list - but any thoughts on this would be very much appreciated.
[/list]
Finally, do you think I am going about this the right way, using a CESP, or should I be using a different kind of asset altogether to create my searchable archive? I've only been using Matrix for 8 months, so am more than happy to be told that I would be better using a different sort of asset!
Many thanks for any help you can give me.
Cheers,
Stu
Stuart Willis
Website Officer
Yorkshire Dales National Park Authority,
Colvend, Hebden Road, Grassington, Skipton,
North Yorkshire BD23 5LB.
Direct line: 01756 751640
Email: [email="stuart.willis@yorkshiredales.org.uk"]stuart.willis@yorkshiredales.org.uk[/email]
Website: this page