Skip to content

Each date change should trigger change event #29

@slavede

Description

@slavede

Inside bindChangeEvent you are checking if date is invalid with checkDate and if so you return back without triggering change event even though you are changing date inside checkDate:

    checkDate: function (day, month, year) {
        var invalidDate;

        if (month !== '00') {
            var numDaysInMonth = (new Date(year, month, 0).getDate()),
                selectedDayInt = parseInt(day, 10);

            invalidDate = this.updateDayOptions(numDaysInMonth, selectedDayInt);

            // If the date is invalid, empty the hidden field to prevent invalid submissions
            if (invalidDate) {
                this.internals.objectRefs.hiddenField.val('');
            }
        }

        return invalidDate;
    }

We should add:

                    this.internals.objectRefs.hiddenField.change();

right after this.internals.objectRefs.hiddenField.val('');

OR

Add it inside bindChangeEvent just before return false.

            if (invalidDate) {
                objectRefs.dayDropdown.addClass('invalid');
                return false;
            }

This causes that in case you select December 31st and you switch to february, change event won't be triggered even though is invalid date. But I think it really should

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions