Bug #38930
Dateselector for field type date does not allow options
| Status: | On Hold | Start date: | 2012-07-13 | |
|---|---|---|---|---|
| Priority: | Could have | Due date: | ||
| Assignee: | Alex Kellner | % Done: | 0% |
|
| Category: | Frontend Plugin | |||
| Target version: | Waiting for Sponsoring | |||
| Votes: | 0 |
Description
When choosing date as field type powermail generated a handy jQuery date selector. When selected in FE it starts with the current date, which is default behavior.
That's not convenient for the user when selecting a birthday or similar far stretched dates, as you can only go back and forth by month in date selector.
Suggestion: Either allow options for date selector in backend form or a 3-dropdown date field type.
History
Updated by Alex Kellner 10 months ago
- Status changed from New to On Hold
- Assignee changed from Alexander Grein to Alex Kellner
- Target version set to Waiting for Sponsoring
Would be a nice feature...
Updated by Christoph Ascherl 19 days ago
Acutally you can customize datepickers with all needed options already today.
For doing this I included an additional JavaScript file into my web site:
page.includeJSFooterlibs.file1 = myjavascriptfile.js
In this file I added a customized document ready function.
Most of the content you can take over from powermail/Resources/Public/form.js
My jQuery selector matches exactly the datepicker controls I want to customize (please refer to http://www.tutorialspoint.com/jquery/jquery-selectors.htm for this).
For customizing these controls I just added the minDate and maxDate options.
A list of all available datepicker options you can find here: http://api.jqueryui.com/datepicker/
jQuery(document).ready(function($) {
$( '.uid33 #powermail_field_check_in, .uid41 #powermail_field_check_in' ).datepicker({
minDate: '+1W',
maxDate: '+1Y +6M',
dateFormat: $('.container_datepicker_dateformat:first').val(),
dayNamesMin: [
$('.container_datepicker_day_so:first').val(),
$('.container_datepicker_day_mo:first').val(),
$('.container_datepicker_day_tu:first').val(),
$('.container_datepicker_day_we:first').val(),
$('.container_datepicker_day_th:first').val(),
$('.container_datepicker_day_fr:first').val(),
$('.container_datepicker_day_sa:first').val()
],
monthNames: [
$('.container_datepicker_month_jan:first').val(),
$('.container_datepicker_month_feb:first').val(),
$('.container_datepicker_month_mar:first').val(),
$('.container_datepicker_month_apr:first').val(),
$('.container_datepicker_month_may:first').val(),
$('.container_datepicker_month_jun:first').val(),
$('.container_datepicker_month_jul:first').val(),
$('.container_datepicker_month_aug:first').val(),
$('.container_datepicker_month_sep:first').val(),
$('.container_datepicker_month_oct:first').val(),
$('.container_datepicker_month_nov:first').val(),
$('.container_datepicker_month_dec:first').val()
],
nextText: '>',
prevText: '<',
firstDay: 1
});
BTW: be aware, setting minDate and maxDate only customizes the calendar control and is not a field validation as the user also can enter a date directly into the edit control.