javascript - Opening second datepicker after selecting date -
i have 2 datepicker inputs , i'm trying automatically open second 1 after date selected in first. of now, datebox opens , promptly closes. can fine outside of knockout.js viewmodel without datebox closing, problem want second datebox open if first 1 has valid date.
this works fine outside of viewmodel, mentioned above, doesn't account errors start date.
$("#start_date_input").datepicker('option',"onclose", function() { $( "#start_date_input" ).datepicker( "show" ); });
this i'd second datepicker triggered
self.startdate.subscribe(function(){ var startdateerrors = ko.validation.group(self.startdatevalidation); var enddateerrors = ko.validation.group(self.enddatevalidation); if(startdateerrors().length == 0 && enddateerrors().length == 0){ populatelist(); } else if(startdateerrors().length == 0){ //if valid start date selected, show end date $("#end_date_input").datepicker("show"); } });
as select start date, end date picker shows , disappears. cursor still in end date input box , flashing. idea causing close?
i tried adding $("end_date_input").datepicker({autoclose: false});
didn't anything.
don't reach around viewmodel , fiddle dom directly. need custom binding handler datepicker. there 1 here seems pretty popular. won't solve problem, put in better place in control of what's going on.
i suspect (but don't know) having hasfocus
binding on associated input field show datepicker properly.
Comments
Post a Comment