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

Already on GitHub? Sign in to your account

Multiple Parameters Rules and Attributes #112

markusblair opened this Issue May 20, 2011 · 3 comments


None yet
3 participants

If you add an attribute to an control to represent the range rule (and I assume the rangelength). The parameters are improperly set. The issue is in the appears in the normalizeRules method line 852 of 1.8.1:

    $.each(['rangelength', 'range'], function() {
        if (rules[this]) {
            rules[this] = [Number(rules[this][0]), Number(rules[this][1])];

In the case that a rule is added to the control via an attribute rules[this] is a string not an array. I patched the issue with the following code:

    $.each(['rangelength', 'range'], function() {
                   if (typeof rules[this] == 'string') {
                                  rules[this] = rules[this].spilt(",");
        if (rules[this]) {
            rules[this] = [Number(rules[this][0]), Number(rules[this][1])];

Now is my attribute is range="1,50" the control is properly validated.



ghost commented Jul 13, 2011

Instead of using parse, use split:

rules[this] = rules[this].split(",");

I had the same issue though - thanks Mark for the patch.

Kipriz commented Aug 24, 2011

It is a great fix. You should submit pull request with this patch.


mlynch commented May 25, 2012

I actually added support for this without knowing about this issue. Instead of adding this separately, I think it makes more sense to be included along with the HTML5 data attribute support, and we do away with specifying these options as attributes. See #432

@mlynch mlynch closed this May 25, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment