jtsage / jtsage-datebox

A multi-mode date and time picker for Bootstrap (3&4), jQueryMobile, Foundation, Bulma, FomanticUI, and UIKit (or others)
http://datebox.jtsage.dev/
Other
474 stars 166 forks source link

After keypad input, clicking on plus minus doesn't increment/decrement current value #306

Closed SunilrajChavan closed 10 years ago

SunilrajChavan commented 10 years ago

Hi,

I have been facing this issue, when i enter a value in the date field from keypad and click on the plus button, it does not increment the current values rather increments the value which was present their earlier. Need a quick solution for this, its been reported as a bug in my project i tried various things but could not fix this.

Kindly provide a solution.

Thanks, Sunilraj

SunilrajChavan commented 10 years ago

Please could anybody suggest some fix for this asap..

jnyrup commented 10 years ago

Hi Sunilraj

To get the desired functionailty, in jqm-datebox.mode.datebox.js or jqm-datebox.comp.datebox.min.js if you use the compiled js file, change divIn.on('change', 'input', function() { w._dbox_enter($(this)); }); to this divIn.on('change keyup', 'input', function() { w._dbox_enter($(this)); });

Just because it's a bug in your project, doesn't make it a bug in jQuery-Mobile-DateBox. If you need a quick fix, pay somebody, remember that this is free software - ie. no one gets paid for developing or supporting.

SunilrajChavan commented 10 years ago

Thanks for the response, i couldn't fix this so asked for help. I saw the same behaviour in the http://dev.jtsage.com/jQM-DateBox/ site so asked for opinions. The solution worked for desktop browser, but the behaviour is same on mobile browsers... any other opinion..??

jnyrup commented 10 years ago

Which mobile and browser do you use? The 'keyup' event works on my HTC One (Android 4.4.2) with Chrome 32 I think the 'input' event might be more appropriate as it "Fires when a user enters text in a textbox". Here's a list of events: Fires when a user enters text in a textbox

SunilrajChavan commented 10 years ago

Hi Jonas,

The input evemt helped, thanks a lot for the solution..

Regards, Sunilraj On Feb 13, 2014 1:20 PM, "Jonas Nyrup" notifications@github.com wrote:

Hi Sunilraj

To get the desired functionailty, in jqm-datebox.mode.datebox.js or jqm-datebox.comp.datebox.min.js if you use the compiled js file, change divIn.on('change', 'input', function() { w._dbox_enter($(this)); }); to this divIn.on('change keyup', 'input', function() { w._dbox_enter($(this)); });

Just because it's a bug in your project, doesn't make it a bug in jQuery-Mobile-DateBox. If you need a quick fix, pay somebody, remember that this is free software

  • ie. no one gets paid for developing or supporting.

Reply to this email directly or view it on GitHubhttps://github.com/jtsage/jquery-mobile-datebox/issues/306#issuecomment-34955351 .

jtsage commented 10 years ago

Ah, yeah - here is the problem - using either input or keyup with data limiting - the event fires to early. So, if your valid months were July-Dec, and you typed the "1" of Dec, the event fires, datebox doesn't like it (Since 1=January), and immediately corrects it to the closest month (July = 7). Which basically makes it impossible to enter date that is more than one character long. If anybody has any clever ideas on a workaround, I'm all ears.

jtsage commented 10 years ago

I lied, just set it so that the plus/minus buttons first blur the input element - means a wasted click, but at least the inputted value is parsed rather than being discarded. Closed in #300