I am using jEditable together with jQuery DatePicker. I am trying to do validation for a date range. For example, if 1st June 2010 is selected in the startDate
field, the user cannot select dates before 1st June 2010 in the endDate
field and vice versa.
All of the other codes are working except the validation part. What I understand is that the full version of jQuery-ui DatePicker is included in the jEditable version but I do not know how to use it.
This is the DatePicker I am using: https://github.com/qertoip/jeditable-datepicker/tree/master/src
Sample Demo of DatePicker plugin: http://thesingularity.pl/jeditable-datepicker-demo/
My script
$( '#startDate' ).editable('AppUpdateServlet',{
indicator : '<img src="images/indicator.gif">',
type: 'datepicker',
datepicker: {
dateFormat: 'dd/mm/yy',
//minDate: '+1w' (this is working)
onSelect: function() {
//the alert is working
//alert("working");
//not working
$('#endDate').datepicker('option', {minDate: $(this).datepicker('getDate')});
}
}
});
$( '#endDate' ).editable('AppUpdateServlet',{
indicator : '<img src="images/indicator.gif">',
type: 'datepicker',
datepicker: {
dateFormat: 'dd/mm/yy',
onSelect: function() {
//not working
$('#startDate').datepicker('option', {minDate: $(this).datepicker('getDate')});
}
}
});
HTML snippet
<span id="startDate">
<%=test.getStartDate()%>
</span>
<span id="endDate">
<%=test.getEndDate()%>
</span>
Not possible to reference to datepicker in jEditable. I have switched to using pure jQuery Datepicker to solve my problem.