vitalets / combodate

Dropdown date and time picker
http://vitalets.github.com/combodate
207 stars 82 forks source link

How to Change Year on firing an event #26

Open 1737 opened 10 years ago

1737 commented 10 years ago

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

vitalets commented 9 years ago

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 9 years ago

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

vitalets commented 9 years ago

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