jQuery-Form-Validator
jQuery-Form-Validator copied to clipboard
"depends-on-value" and negative values
Hi, I'm trying to make an inut working with "depends-on-value" property, which depends on "-1". Since the regex in the split function is "'[,|'+(allowSpaceAsDelimiter ? '\s':'')+'-]\s*'" , which means it splits on "," , "|" and "-" if I get it right and so - depending on a negative value seems rather impossible. The split actually converts the "-1" to an array of "empty" and "1". Is this correct or I'm missing something ? If it is correct - then this seems to be a huge shortcoming, then.
Having the same problem. For myself, I've addressed this by changing logic.js
listWithRequiredValues = $.split($input.valAttr('depends-on-value'), false, false),
to
listWithRequiredValues = $input.valAttr('depends-on-value').split(/[,|]\s*/),
I actually think a better delimiter is an unlikely-to-be-used character like the pipe |, or perhaps the double-pipe ||, but this would potentially be a breaking change to anyone who was using dashes as delimiter (but seriously, who does that?).