Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Min/Max values Not Working #6

Open
toddca opened this issue Sep 27, 2012 · 3 comments
Open

Min/Max values Not Working #6

toddca opened this issue Sep 27, 2012 · 3 comments

Comments

@toddca
Copy link

toddca commented Sep 27, 2012

Setting a min value of 1900 and max value of 2013 I cannot type into the input element. Even if I set the default value of the element to 1900 I still cannot change the value. This works with min=0 and max=2013 but not when min>9. Tested on FireFox V15.

input type="text" value="" name="PlainNumberMaxMin" id="PlainNumberMaxMin" data-val-number="The field Plain Number Max Min must be a number." data-val-min-numeric="1900" data-val-max-numeric="2011" data-val="true" class="t-format-plainnumber input-medium valid" autocomplete="off"

$('#t-main-form').find("input.t-format-plainnumber").each(function () {

    var maxValue = $(this).attr("data-val-max-numeric");
    var minValue = $(this).attr("data-val-min-numeric");

    if (maxValue == null) maxValue = 999999999;
    if (minValue == null) minValue = 0;

    var options = { mDec: 0, vMin: minValue, vMax: maxValue, aSep:'' };

    if (minValue > 0) {
        $(this).val(minValue);
    }

    $(this).autoNumeric(options);
    if ($(this).val() != '') {
        $(this).autoNumericSet($(this).val());
    }

});
@BobKnothe
Copy link
Collaborator

Todd,This behavior is an issue when the min max values are relatively close because changing the values violates the min\max rules. I suggest that you set the min value to zero and validate the value on focusout.Version 1.8.0 (http://www.decorplanit.com/plugin/autoNumeric-1.8.0-beta.htm) will be released soon. Just need to update the documentation. It is a nice improvement.Best regards,Bob 

-------- Original Message --------
Subject: [auto_numeric_js] Min/Max values (#6)
From: Todd Carter [email protected]
Date: Thu, September 27, 2012 7:53 am
To: funny-falcon/auto_numeric_js [email protected] a min value of 1900 and max value of 2013 I cannot type into the input element. Even if I set the default value of the element to 1900 I still cannot change the value. This works with min=0 and max=2013 but not when min>9. Tested on FireFox V15. $('#t-main-form').find("input.t-format-plainnumber").each(function () { var maxValue = $(this).attr("data-val-max-numeric");
var minValue = $(this).attr("data-val-min-numeric");

if (maxValue == null) maxValue = 999999999;
if (minValue == null) minValue = 0;

var options = { mDec: 0, vMin: minValue, vMax: maxValue, aSep:'' };

if (minValue > 0) {
    $(this).val(minValue);
}

$(this).autoNumeric(options);
if ($(this).val() != '') {
    $(this).autoNumericSet($(this).val());
}

});
— Reply to this email directly or view it on GitHub.

@toddca
Copy link
Author

toddca commented Sep 27, 2012

Thanks Bob - so are you saying 1.8 addresses this issue?

What I am trying to do is have an input element where someone was enter in a year. The year represents the year model of your car, truck or van so a drop down list is not something we want based on the large number of possible values. The idea is to have someone type in a number only, no comma, and have the value validate good when the number is between 1900 and current year + 1 (2013).

I believe the core issue is that to type a number 1999 you must first type 1 then 19, then 199 and each of these values is less than the min value therefore not accepted by the autoNumeric plugin.

Thanks again for your help and great plugin.

@BobKnothe
Copy link
Collaborator

Todd,

No it does not address this behavior.

It just has some cool new features.

Bob

Robert (Bob) Knothe

On Sep 27, 2012, at 10:47 AM, Todd Carter [email protected] wrote:

Thanks Bob - so are you saying 1.8 addresses this issue?

What I am trying to do is have an input element where someone was enter in a year. The year represents the year model of your car, truck or van so a drop down list is not something we want based on the large number of possible values. The idea is to have someone type in a number only, no comma, and have the value validate good when the number is between 1900 and current year + 1 (2013).

I believe the core issue is that to type a number 1999 you must first type 1 then 19, then 199 and each of these values is less than the min value therefore not accepted by the autoNumeric plugin.

Thanks again for your help and great plugin.


Reply to this email directly or view it on GitHub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants