-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
E_VALIDATION rule integer Value should be an integer #4215
Comments
Hi @simonecogno! It looks like you missed a step or two when you created your issue. Please edit your comment (use the pencil icon at the top-right corner of the comment box) and fix the following:
As soon as those items are rectified, post a new comment (e.g. “Ok, fixed!”) below and we'll take a look. Thanks! *If you feel this message is in error, or you want to debate the merits of my existence (sniffle), please contact inquiries@sailsjs.com |
ok, fixed! |
@simonecogno Thanks for posting, we'll take a look as soon as possible. For help with questions about Sails, click here. If you’re interested in hiring @sailsbot and her minions in Austin, click here. |
Ok fixed. The problem was that before the validation the value was NaN. Maybe this value was coming from the fronted input field or after the integer validation. Anyways it works fine by adding this check in the validation:
|
Sails version: 0.12
Node version: 6.11.4
NPM version: 3.10.0
DB adapter name: sails-mongo
DB adapter version: 0.12
Operating system: Linux
I have a problem with
integer
types. If I set it tointeger
then if the value is null I receive the following error:{"error":"E_VALIDATION","status":400,"summary":"1 attribute is invalid","model":"Test","invalidAttributes":{"test":[{"rule":"integer","message":"Value should be an integer"}]}}
My model configuration:
As I didn't set the
require
validator null values should be accepted.If I set the value with a integer or witha a string containing an integer then it work fine.
What I'm doing wrong here? Or how can I allow null values on
integer
fields?Link to stackoveflow question: https://stackoverflow.com/questions/46785754/sailsjs-e-validation-rule-integer-value-should-be-an-integer
The text was updated successfully, but these errors were encountered: