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
In sails validation are series of rules on attribute which sails-hook-validation tap in to them and pick any validation error found and match it with your custom validation messages.
So your validation messages must contain valid sails validation rules.
Yes, helped a lot!
My mistake was to use the field name instead of rule name as you mentioned.
i already added minLength and other rules, everything works now.
Hello,
i think that i cannot customize validation messages of attributes with type "date" with your module
(sails v0.11 updated and latest module code too),
in my model User i have one attribute set as:
birthday: {
type: 'date',
required: true,
unique: false
},
in validationMessages object i added:
birthday: {
required: 'Your birthday is required',
birthday: 'Birthday is not a valid date'
}
when i called the User.create function (in Controller), with a invalid date 'aaa' in attribute birthday,
User.create(data, function(error, user) { (...) });
it returns validation errors as expected, but error.Error is empty (empty object {})
if i retrieve invalidAttributes property from errors, i get the original validation error:
{ birthday:
[ { rule: 'date',
message: '
undefined
should be a date (instead of "aaa", which is a string)' } ] }am i doing something wrong or date type validation is not customized correctly with your module?
thanks in advance.
The text was updated successfully, but these errors were encountered: