0

I am using this slider:

http://jquerytools.org/documentation/rangeinput/index.html

The code it generates looks like this:

<input id="AddedValue" max="100000" min="0" name="AddedValue" type="text" data-orig-type="range" value="0" class="range">

Now, when i use this slider, and set it to any value, it says, that the value needs to be less or equal 100000. How can I fix this? Or is there any method that lets me disable validation for this single input?

1
  • 1
    The code it generates? What about the code you've written to get it to generate that code? What's giving you the error? The javascript console? Need more information, to give you better advice. Commented Feb 22, 2013 at 21:04

1 Answer 1

1

Your problem is being caused by the min and max attributes you've added to your input. The jQuery Validate plugin takes these and thinks they are your rules. Even the ignore option is "ignored" in this case.... it still thinks these are valid rules.

<input id="AddedValue" max="100000" min="0" name="AddedValue" type="text" data-orig-type="range" value="0" class="range">

OP: "Or is there any method that lets me disable validation for this single input?"

Until you show more code, the simple solution would be to remove the min and max attributes from that element. Perhaps your input slider allows you to define the min & max another way. Although, since it's part of the jQueryTools package, I would not expect anything to follow normal conventions.

EDIT:

It seems like there's a conflict, and in my brief tests with jsFiddle, I'd say it's caused by jQueryTools. The most logical solution would be to remove these inline attributes from the input element and declare each plugin's options independently using jQuery...

$(document).ready(function() {

    $('#myform').validate({  // jQuery Validate setup
        // other options,
        rules: {
            AddedValue: {
                min: 0,
                max: 100000
            }
        }
    });

    $('#AddedValue').rangeinput({  // jQueryTools Rangeinput setup
        // other options,
        min: 0,
        max: 100000
    });

});

To be perfectly blunt, if jQueryTools can't play nice with other jQuery plugins, I'd dump it for something else. (If you dig into it further, you'll discover that jQueryTools has had only one update since jQuery 1.3 and been without a developer for almost as long. Browse their user forum and the Github site, you'll find very little interest by Tero in supporting his creation, and for the last 18 months or so, been unable to find anyone to take over the lead.)

Sign up to request clarification or add additional context in comments.

2 Comments

Yes. It thinks that those are my rules, but it validates them incorrectly! I can input value like 100, and it says that this value needs to be less or equal 100000! :/
@ojek, jQuery Validate works when the rules are declared via jQuery. Please construct a jsFiddle demo of your problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.