vitalets/combodate

How to Change Year on firing an event

Opened this issue · 3 comments

1737 commented

I want to change my Year dropdown while i am firing an event of another control.

Like: i have checkboxlist and i want to update Year dropdown on the basis of selection of checkboxlist.

Kindly give me a solution or how to do it.
Thanks
Rohit

hi, you should use getValue / setValue methods, e.g.

$('.checkbox').click(function() {
    // retrieve current value from cobmodate
    var date = $('#dob').combodate('getValue', null);
    // change year
    date.year(2014);
    // update value back
    $('#dob').combodate('setValue', date);
});
1737 commented

Thanks for helping me out for this. I love to work with combodate its a very good and very special thing to work on date.

If i want to set the range of a year dropdown of combodate can it be possible to set the year.

let suppost i have two checkboxes. for selection of first checkbox i want to set the range of year dropdown in between 1987 - 2014 and on selection of second checkbox i want to set the range of year in between 1983 - 2014.

Thanks
Rohit

Oh, I get your point. Currently it's not possible, I'll have a look on this soon.
Reopening/