Pregunta

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?

¿Fue útil?

Solución

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.)

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top