You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When validate is used with an array, specified error messages are ignored. Instead, it's defaulting to the {field} is not valid default error message (per @PepperTeasdale 's suggestion, adding required: true solved this specific problem, but it shouldn't need that extra key)
Example schema:
{
ageDied: {
validate: [
{
...isPresent,
validateIf: ({ diedFromDisease }) => diedFromDisease
},
{
validator: ({ ageContracted }, value) => parseInt(ageContracted) < parseInt(value),
errorMessage: 'this field cannot be before Age Contracted',
required: true, // to be removed
validateIf: ({ diedFromDisease }) => diedFromDisease
},
]
},
}
The text was updated successfully, but these errors were encountered:
When
validate
is used with an array, specified error messages are ignored. Instead, it's defaulting to the{field} is not valid
default error message (per @PepperTeasdale 's suggestion, addingrequired: true
solved this specific problem, but it shouldn't need that extra key)Example schema:
The text was updated successfully, but these errors were encountered: