I have found some wicked way to do it. This is the code where I'm writing a plugin to accept date range pair and auto-init them.
//Assuming from/to date have same prefix id (e.g. #eventFromDate, #eventToDate) $.fn.datepickerPair = function(options){ return this.datepicker( $.extend({ beforeShow:function(elem){ var id = elem.id; var isFrom = /FromDate$/.test(id); var prefix = id.replace(/(FromDate|ToDate)$/,''); var minDate = isFrom?null: $.datepicker._getInst($ ("#"+prefix+"FromDate").get(0)._calId)._setDateFromField("#"+prefix +"FromDate"); var maxDate = !isFrom?null: $.datepicker._getInst($ ("#"+prefix+"ToDate").get(0)._calId)._setDateFromField("#"+prefix +"ToDate"); return {minDate:minDate, maxDate:maxDate}; },options) ); } Any other 'cleaner' way? On 4月11日, 上午1時09分, Jacky See <[EMAIL PROTECTED]> wrote: > Dear all, > > This is about the ui datepicker. > > I have an input field with a datepicker, using image as trigger. > The field is not read only, user are allowed to input by keyboard. > > The problem is that when user type some invalid input like '333333' > the $('#input').datepicker('getdate'), will still only get the last > selected date. > > Is that any way to get the 'fresh' date? > Any trigger I can call? > I need it to fill in a date range using 'beforeShow' option.