diff options
author | Karl Kirch <karl.ctr.kirch@faa.gov> | 2011-08-09 09:55:50 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2011-08-09 09:55:50 -0400 |
commit | d14629735648fb10403e38eac2b764ce6adf56c9 (patch) | |
tree | 2e08a076f2e89933e751e56451354a4fad39ce55 /ui/jquery.ui.datepicker.js | |
parent | 7f812f8be99bf8dc483b84b12432b61a8e3d59cd (diff) | |
download | jquery-ui-d14629735648fb10403e38eac2b764ce6adf56c9.tar.gz jquery-ui-d14629735648fb10403e38eac2b764ce6adf56c9.zip |
Datepicker: Added ability to stop datepicker from beforeShow. Fixes #7602 - Ability to stop datepicker from appearing with beforeShow event handler.
Diffstat (limited to 'ui/jquery.ui.datepicker.js')
-rw-r--r-- | ui/jquery.ui.datepicker.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/ui/jquery.ui.datepicker.js b/ui/jquery.ui.datepicker.js index ade580220..3b8caa59b 100644 --- a/ui/jquery.ui.datepicker.js +++ b/ui/jquery.ui.datepicker.js @@ -625,6 +625,7 @@ $.extend(Datepicker.prototype, { }, /* Pop-up the date picker for a given input field. + If false returned from beforeShow event handler do not show. @param input element - the input field attached to the date picker or event - if triggered by focus */ _showDatepicker: function(input) { @@ -641,7 +642,12 @@ $.extend(Datepicker.prototype, { $.datepicker._curInst.dpDiv.stop(true, true); } var beforeShow = $.datepicker._get(inst, 'beforeShow'); - extendRemove(inst.settings, (beforeShow ? beforeShow.apply(input, [input, inst]) : {})); + var beforeShowSettings = beforeShow ? beforeShow.apply(input, [input, inst]) : {}; + if(beforeShowSettings === false){ + //false + return; + } + extendRemove(inst.settings, beforeShowSettings); inst.lastVal = null; $.datepicker._lastInput = input; $.datepicker._setDateFromField(inst); |