bootstrap-datepicker icon indicating copy to clipboard operation
bootstrap-datepicker copied to clipboard

Open only on Calendar Icon

Open krogis01 opened this issue 11 years ago • 7 comments

@eternicode This may be a duplicate ticket of #456, but I'm not sure if it's a new issue since that was from a year or two back). I'm having an issue, and am not sure if #377 solved it or if the fix is still in the works... I'm using the "showOnFocus" method (set to False- have tried in both JS and HTML), but rather than only focusing when clicking the calendar icon, it eliminates focus on everything. Am I using the method incorrectly? Code sample below.

HTML:

<div class="input-group date">
    <input id="date" type="text" maxlength="14" class="form-control our-date-picker" data-provide="our-date-picker" data-date-autoclose="true" data-date-toggle-active="true" data-date-show-on-focus="false"/>
    <span class="input-group-addon">
        <i class="fa fa-calendar"></i>
    </span>
</div>

Javascript:

$('#sandbox-container input').datepicker({
    orientation: "top right",
    showOnFocus: "false"
});

image

krogis01 avatar Oct 08 '15 20:10 krogis01

can you provide a jsfiddle?

hebbet avatar Oct 09 '15 13:10 hebbet

We got it as close to how it is currently working in ours as we could; if you set the data-date-show-on-focus to true, it works the same as ours (except that ours also opens on clicking the calendar). On setting it to false, it works the same as ours. We can also use the methods in our Javascript, but for some reason couldn't replicate this on jsfiddle; let me know if this helps! Thank you so much!

https://jsfiddle.net/tn7d8nfx/9/

krogis01 avatar Oct 09 '15 14:10 krogis01

The behaviour of showOnFocus="false" seems to be inconsistent between using the data-date-show-on-focus attribute, and setting $.fn.datepicker.defaults.showOnFocus in JS. If set using the attribute, the calendar is still displayed the first time the input receives focus.

https://jsfiddle.net/DonDavio/kke1jbbj/8/

DonDavio avatar Jan 11 '16 09:01 DonDavio

I've been seeing what DonDavio describes in my project. Setting the defaults via $.fn.datepicker.defaults on page load and using lazy init like the addon example with data-provide="datepicker". First time the input is focused the picker shows. Any subsequent focus works as should be expected. It's like the defaults aren't being applied until after the datepicker has been initialized and shown.

jason-bean avatar Jul 08 '16 20:07 jason-bean

I am having this same issue, the picker shows the first activation even though I'm asking it not to with data-date-show-on-focus="false"

slycrel avatar Aug 29 '16 20:08 slycrel

This problem still exists today with version 1.6.4.

vppetrov avatar Jan 25 '18 08:01 vppetrov

Still having the exact same problem. Anybody knows if this is already fixed or not?

EzePerucca avatar Jun 19 '20 13:06 EzePerucca