This repository was archived by the owner on Dec 12, 2021. It is now read-only.

Description
The message option is limited to strings, which makes it non-trivial to deal with arrays, objects, etc.
var acceptedValues = [
{ id: 1, name: 'Banana' },
{ id: 2, name: 'Apple' },
{ id: 2, name: 'Mango' }
]
// Fruit is chosen through select which uses ids for value attribute
var constraints = {
fruit: {
within: acceptedValues.map(function (o) { return o.id }),
message: function (id) {
return '^No such fruit ' + getFruitById(id) + ' available.'
}
}
}