Hello,
Is it possible for a date formatted text field to show the Contao calendar in FE ?
Thanks.
Printable View
Hello,
Is it possible for a date formatted text field to show the Contao calendar in FE ?
Thanks.
Yes. I don't know if EFG has a specific method, but generally you need to add the 'plugins/calendar/js/calendar.js' and 'plugins/calendar/css/calendar.css' to the head of the page, and a javascript to instantiate a new calendar to the body of the page.
Use the format ctrl_yourFieldName.
eg - for a field called firstnight:
andCode:$GLOBALS['TL_JAVASCRIPT'][] = 'plugins/calendar/js/calendar.js';
$GLOBALS['TL_CSS'][] = 'plugins/calendar/css/calendar.css';
Code:<script type="text/javascript">
<![CDATA[//><!--
window.addEvent('domready', function() { new Calendar({ ctrl_firstnight: '<?php echo 'd.m.Y'; ?>' }, { navigation: 2, days: ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'], months: ['January','February','March','April','May','June','July','August','September','October','November','December'], offset: 0, titleFormat: 'l, dS of F Y', direction: .5 }); });
//--><!]]>
</script>
Thanks for your answer.
In facts, I've just found Calendarfield extension in Contao repository which is absolutely what I looked for.