Datepicker
Cloudrexx uses the jQuery Datepicker and Datetimepicker UI widgets for selecting a date or time.
How to Use
Note
- By default, the format of the date is
dd.mm.yy
and the format of the time ishh:mm:ss
. - The locale used by the picker is set automaticlaly through to i18n. Missing locales can be added as additional files under
/lib/javascript/jquery/ui/i18n
. - The default style file is located at
/lib/javascript/jquery/ui/css/jquery-ui.css
. Don't edit this file because it fits for the Contrexx backend. If you want to load your own style in the frontend, you can create a style file at/themes/<theme>/jquery-ui.css
. Javascript automatically loads this file if it exists.
Activation
As the required functionality is provided by the Javascript Framework, it needs to be activated on the server side (using PHP):
Integration
Automatic widget generation (from PHP)
Use one of Html::getDatepicker()
, Html::getDatetimepicker()
or Html::getTimepicker()
to generate the HTML code for a UI date/time widget.
Date selection
Whereas
$name
is the HTML input field name
attribute and $template
is the current instance of \Cx\Core\Html\Sigma
.
Date & time selection
Whereas
$name
is the HTML input field name
attribute and $template
is the current instance of \Cx\Core\Html\Sigma
.
Time selection
Whereas
$name
is the HTML input field name
attribute and $template
is the current instance of \Cx\Core\Html\Sigma
.
Manual widget generation (in JavaScript)
Date Picker
The above code generates a date picker on the input field. The value which is set by the input attribute value
is going to be the datepicker's default value.
Date & Time Picker
The above code generates a date & time picker on the input field. The value which is set by the input attribute value
is going to be the datetimepicker's default value.
Date & Time Picker with custom format
The above code generates a date & time picker using a custom format.
Date & Time Picker for start and end date selection
The above code will generate a datetimepicker for the start and end date. The option "onSelect" allows to define a function which will be executed after selecting a date or time. In this case the function will validate the selection of the user to avoid an invalid date range.