I have a form where there can be 1 or many inputs (of the class ".amount-input") that all have to meet a minimum value. Depending on another input, the minimum might be zero (0) or it might be one (1).
Plus, I'm using a numeric mask plug-in on my text boxes, so the numbers might have commas in them. This is why the built-in "min" validation won't work, because the comma is seen as invalid. Oddly enough, the "number" validation works fine if there's a comma.
So, I'm trying to create a custom validator and it doesn't appear to be working properly. When it executes, it looks like I always get True back even through I set one of the values to 0 and the minValue is set to "1". I would think that upon trying to submit the form, the form would not submit and I would get the message shown below, but the form continues with submission and ignores the fact that I have an invalid input. What might I be doing wrong?
$.validator.methods.minCheck = function (value, element, options) {
var validOrNot = true;
var minValue = ($('input[name=Quantity]').val() == 3) ? 0 : 1;