backbone-forms
backbone-forms copied to clipboard
Empty and non-matching field should fail match validation
If it is empty, a field with match
validation type passes validation even though its value does not match. The field is in a known invalid state and so validation should fail.
This was actually an intentional decision, so that you can have fields that aren't required (can be empty) but if a value is submitted then it must match the validator.
You can 'fix' this by just adding a 'required' validator as well as the match validator.
That's only a "fix" if the field is required. If fields are optional but need to match then it's the very opposite of a fix.
Sorry, my mistake - I thought you were referring to a general Regular Expression match
Yes, I see your point with respect to not validating empty values for certain validators, but I think the match validator in particular should pass iff the field values match.