UPDATE: Beginning with v1.4RC, Couch ships with a native 'datetime' editable region that can be used as an alternative to the technique discussed in this thread. Full details of the region can be found here: viewtopic.php?p=12667#p12667
Original message:
To complement @cheesypoof's 'Colorpicker' (http://couchcms.com/forum/viewtopic.php?f=8&t=7124), here comes a 'Datepicker'.
Does not have a lot of features but helped me get by on at least one occasion (an events calender that needed an end date for each item).
Place the attached files into the 'couch' folder and then create the following two editable regions in any template that requires the datepicker
1. of type text that actually holds the date inputted.
2. of type 'message' that injects the JavaScript library that shows the calender popup to help in choosing a date.
Please note that the name of the text region is 'end_date' while the datepicker is given 'f_end_date' (i.e. 'f_' appended)
Original message:
To complement @cheesypoof's 'Colorpicker' (http://couchcms.com/forum/viewtopic.php?f=8&t=7124), here comes a 'Datepicker'.
Does not have a lot of features but helped me get by on at least one occasion (an events calender that needed an end date for each item).
Place the attached files into the 'couch' folder and then create the following two editable regions in any template that requires the datepicker
1. of type text that actually holds the date inputted.
2. of type 'message' that injects the JavaScript library that shows the calender popup to help in choosing a date.
- Code: Select all
<cms:editable name='end_date'
label='Event End Date (if multi-days event)'
desc='Enter date in yyyy-mm-dd format e.g. 2010-12-31'
type='text'
validator='regex=/(?:19|20)\d\d-(?:0[1-9]|1[012])-(?:0[1-9]|[12][0-9]|3[01])/'
separator='#'
validator_msg='regex=Incorrect date format'
width='155'
/>
<cms:editable name='datepicker' type='message'>
<link rel="stylesheet" type="text/css" media="all" href="<cms:show k_admin_link />addons/datepicker/datepicker.css" />
<script type="text/javascript" src="<cms:show k_admin_link />addons/datepicker/datepicker.js"></script>
<script type="text/javascript">
window.addEvent('domready',
function(){
$('f_end_date').addEvent('click', function(e){
displayDatePicker('f_end_date');
});
}
);
</script>
</cms:editable>
Please note that the name of the text region is 'end_date' while the datepicker is given 'f_end_date' (i.e. 'f_' appended)
$('f_end_date').addEvent('click', function(e){
displayDatePicker('f_end_date');
});