EmKayDK / jstepper

A jQuery plugin usable for making a numeric textfield value easy to increase or decrease
ISC License
18 stars 6 forks source link

Cannot use input type number. #1

Closed tsara27 closed 7 years ago

tsara27 commented 10 years ago

If I use input type number.

I can use the min and max feature but when I type alphabet, it doesn't work.

EmKayDK commented 10 years ago

First of all, when you use jStepper on a field, it's because you want a numeric value in the field, so it does not make much sense that you want to be able to write alphabet letters in the field. Can you clarify why you want to do this?

Second of all, using jStepper on a input with type="number" is kind of double work. The number field already has much of the functionality that jStepper provides, so if you use that field type, maybe you don't need to use jStepper at all. Bear in mind though, that input type="number" is a HTML5 element and as such, it does not work in all browsers. Besides jStepper has some extra functionality besides what the input type="number" provides, so if it's an option, use jStepper ;)

If you want the functionality of jStepper and you want to include a lot more browsers on the list of compatible browsers for your web application, then use an input with type="text" and apply jStepper to it. That's how the plugin is intended, anyway :)

tsara27 commented 10 years ago

I'm sorry, because I thought it was a bug. Because in some occasions, people might use input type="number" instead of text and use other functionality besides the min and max value.

Thanks.

On 13 March 2014 02:44, Martin Kruse notifications@github.com wrote:

First of all, when you use jStepper on a field, it's because you want a numeric value in the field, so it does not make much sense that you want to be able to write alphabet letters in the field. Can you clarify why you want to do this?

Second of all, using jStepper on a input with type="number" is kind of double work. The number field already has much of the functionality that jStepper provides, so if you use that field type, maybe you don't need to use jStepper at all. Bear in mind though, that input type="number" is a HTML5 element and as such, it does not work in all browsers. Besides jStepper has some extra functionality besides what the input type="number" provides, so if it's an option, use jStepper ;)

If you want the functionality of jStepper and you want to include a lot more browsers on the list of compatible browsers for your web application, then use an input with type="text" and apply jStepper to it. That's how the plugin is intended, anyway :)

Reply to this email directly or view it on GitHubhttps://github.com/EmKayDK/jstepper/issues/1#issuecomment-37454890 .

Regards,

Tsara Fatma L

EmKayDK commented 10 years ago

It's ok. Of course it should be possible to use jStepper with an input type="number" also.

However, I will not call it a bug and this is why I will mark this issue as an enhancement.

It will be fixed - I just don't know when at the moment :)

tsara27 commented 10 years ago

Love to hear that, Martin. :)

Thanks. On Mar 20, 2014 2:05 AM, "Martin Kruse" notifications@github.com wrote:

It's ok. Of course it should be possible to use jStepper with an input type="number" also.

However, I will not call it a bug and this is why I will mark this issue as an enhancement.

It will be fixed - I just don't know when at the moment :)

Reply to this email directly or view it on GitHubhttps://github.com/EmKayDK/jstepper/issues/1#issuecomment-38093327 .

jedierikb commented 10 years ago

Big advantage here would be for touch devices to bring up the number pad instead of the full keyboard

goddamnyouryan commented 9 years ago

@EmKayDK Just out of curiosity, has there been any progress on this? I agree with @jedierikb it would be great for touch devices.

EmKayDK commented 9 years ago

There has not been any progress on this yet, but I will get to it eventually :) Sorry to keep you waiting.

EmKayDK commented 9 years ago

I have investigated this and decided not to bring support for the number input field. It is too intrusive and conflicts with the default functionality and the event handling of the stepping in a number field is also quite different compared to a "normal" text field.

However, there are numerous solutions for creating a number field for a touch device and a normal jStepper text field on a regular computer:

Here is one (untested pseudo code):

if (IsTouchDevice()) {
    $('#fieldId').attr('type', 'number');
} else {
    $('#fieldId').jStepper();
}

There are several ways to detect if it is a touch device. Here is a nice StackOverflow question where a lot of the ways are discussed: http://stackoverflow.com/questions/4817029