New Datepicker for Joomla! 3.7

Written by | 01 June 2017 | Published in 2017 June
Since its debut, Joomla! provides a date input field including a selector. It allows you to navigate easily in a calendar month by month and simply click on the desired date to get an entry in the right format. It's handy!  
New Datepicker for Joomla! 3.7 New Datepicker for Joomla! 3.7 Marc Studer

New Datepicker and automatic format

The coming of Joomla! 3.7 includes the replacement of the original DatePicker field (named 'Calendar'). This is all the more fun because this field had not evolved for several years!

Difficulties in maintenability, limited possibilities for personalization, the switch to the new Calendar field made it possible to complete greatly the parameterization of this field:

  • selection of year and month, grouped on 1 single line or separated on 2 independent lines (singleheader parameter)
  • precision of the limits of the years min and max (parameters minyear and maxyear)
  • display or not of the week numbers (parameter weeknumbers)
  • activation of the selection of hours and minutes (showtime parameter)
  • format of the hours on 12h (AM / PM) or 24h (timeformat parameter)
  • gray but selectable display of the days of the previous and following months (in the grid of the current month) (filltable parameter)
  • display the Today button to select today's date (todaybutton parameter)

new datePicker for Joomla! 3.7

In order to explain and document the parameter following the redesign of the Calendar field in Joomla 3.7.0, the official documentation wiki has been updated and presents several examples of use.
https://docs.joomla.org/Calendar_form_field_type

Why XML?

For those who clicked on the link above, you will find that the fields are not coded in HTML, but in XML!
From the beginning, Joomla chose to "separate content and presentation" and very quickly (as of version 1.6), it was decided to model the structure of the input forms in XML, in a separate file from the HTML display page.
Connoisseurs will say "this is not a revolution" and they will be right! Joomla has just chosen to respect a Nth model of programming that has made his proof in the computer industry: the XML modeling of the structure of the forms

full HTML vs XML JForms in Joomla!

 

This solution makes it possible to oppose the Web page which integrates all the code of the screen (1) with a solution in which the web page contains only the graphic part (2). The detail of the form's field structure is encoded in an XML file (3).

By separating the presentation from the form, Joomla! allows the editors of extensions to win on many points:

  • ease of design and maintainability of HTML screens
  • loading and saving of standard input forms
  • reliability in loading and recording processes
  • maintenance and evolution of the structure of simplified forms
  • simple and reliable creation of new fields
  • facilitated sharing with the community
  • ... etc

The approach may seem confusing for a new developer who would not be accustomed to this way of programming, but with little investment, we realize in the very short term that the advantages provided by this solution are saving time and reliability!

The treasure vault of Joomla and the 62 fields!

These documentation pages are a wealth of information for Joomla! administrators, integrators and developers.
The page showing the function of the date selector is only one of the 62 pages presenting the fields usable in the extensions Joomla:
https://docs.joomla.org/Standard_form_field_types

This documentary wealth on input form fields is one of the bibles of the Joomla documentation.
Many developers read it very regularly, beginners as well as confirmed!!

I take this opportunity to remind you that the maintenance of the official documentation is only possible with the help of the volunteers!
No need to be a developer, anyone who knows a Joomla feature can create an account on the wiki and complete / correct the documentation, while registering its name in the marble plate of the authors of the Joomla! documentation.

A special thank you to the administrators and editors of the docs.joomla.org Wiki for the huge work they make!... and which make our life easier every day ;) 

Read 5303 times
Marc Studer

Marc Studer

Membre de la francophonie Joomla, formateur et développeur Joomla! professionnel.
Member of the french Joomla community, teacher and professionnal Joomla! Developer


Auteur de manuels Joomla! aux éditions ENI.
Ancien membre du Conseil d'administration de l'AFUJ / Joomla! France.
Conférencier sur le Framework Joomla! lors des JoomlaDays France depuis 2009.