I have a large table of text inputs for which a set of custom attributes are being created on the server side. These attributes included “min” and “max” which were used with the jQuery Validate plugin.
Due to a change in the requirements (of course), we now have to update the attributes to a range type, however the Validate plugin isn’t interpreting the formatting of the range rule correctly (or perhaps it’s more accurate to say I’m not formatting the rule correctly) and now I have problems.
The generated output for the input boxes looks like this:
<input type="text" producttype="CCC" code="ESTFEE" range="460, 500" class="currency required" id="txtEstFeeCCC" value="460.00" name="txtEstFeeCCC">
I’ve also tried the following:
<input type="text" producttype="CCC" code="ESTFEE" range="[460, 500]" class="currency required" id="txtEstFeeCCC" value="460.00" name="txtEstFeeCCC">
In either case, the message returned is either:
Please enter a value between 4 and 6.
or
Please enter a value between NaN and 4
respectively. Neither of which has anything to do with the 460 – 500 range in question.
The jQuery code calling the validate function is just the vanilla call:
$("#btnSave").click(function() {
validator.form();
...
});
How should an input attribute for jQuery Validate range be formatted so that the correct number range limit is displayed?
You should be able to do:
You could, of course, always just store the values as a range but output as
minandmaxproperties still