Hector Landete
Hector Landete

Reputation: 367

dateDropdown change language properties

I'm initializing a date dropdown using .dateDropdowns().

As I've been reading in this way I should be able to change the language:

$("#date").dateDropdowns({
        minAge: 18,
        submitFormat: "dd/mm/yyyy",
        required: true,
        dayLabel: "Tag",
        monthLabel: "Monat",
        yearLabel: "Jahr",
        initialDayMonthYearValues: ['Tag', 'Monat', 'Jahr'],
        monthLongValues: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli  ', 'August', 'September', 'Oktober', 'November', 'Dezember'],
        monthNamesShort: ['Jan', 'Febr', 'März', 'Apr', 'Mai', 'Juni', 'Juli  ', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez']
    });

But the dropdown still only in English, any idea what can I be doing wrong?

Thanks in advance.

Upvotes: 0

Views: 191

Answers (1)

Bobby Tables
Bobby Tables

Reputation: 3013

Your problem is caused by

checkForDuplicateElement: function () {
    if ($('input[name="' + this.config.submitFieldName + '"]').length) {
        $.error('Duplicate element found');
        return false;
    }
    return true;
},

Change the DOMelements name from date to 'myCustomDate' and change to code to this

$("#myCustomDate").dateDropdowns({
    submitFieldName: 'myCustomDate',
    minAge: 18,
    submitFormat: "dd/mm/yyyy",
    required: true,
    dayLabel: "Tag",
    monthLabel: "Monat",
    yearLabel: "Jahr",
    initialDayMonthYearValues: ['Tag', 'Monat', 'Jahr'],
    monthLongValues: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli  ', 'August', 'September', 'Oktober', 'November', 'Dezember'],
    monthNamesShort: ['Jan', 'Febr', 'März', 'Apr', 'Mai', 'Juni', 'Juli  ', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez']
});

Upvotes: 1

Related Questions