Skip to content
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

'validate=required' doesn't work for number fields #309

Closed
snemarch opened this issue Jun 9, 2016 · 3 comments
Closed

'validate=required' doesn't work for number fields #309

snemarch opened this issue Jun 9, 2016 · 3 comments
Labels

Comments

@snemarch
Copy link
Contributor

snemarch commented Jun 9, 2016

When adding a new row, validate=required fails for number field. Blank fields get the value '0'.

Demo here.

@snemarch snemarch changed the title validate=required doesn't work for number fields 'validate=required' doesn't work for number fields Jun 9, 2016
@tabalinas tabalinas added the bug label Jun 9, 2016
@kerro
Copy link

kerro commented Jun 9, 2016

If a field number isn't filled, the field value is set to 0 and passes the validation

return parseInt(this.insertControl.val() || 0, 10) in jsgrid.field.number.js

@tabalinas
Copy link
Owner

I propose to consider this as a by design. The reason is that number field is defaulted to 0. Thus I don't see any feasible fix w/o a breaking change. So if you want to validate number field, you need to use another validator min.
Of course, it should be specified in docs.

@tabalinas
Copy link
Owner

Reopen the issue. If that one #125 will be fixed, we can fix this issue also.

@tabalinas tabalinas reopened this Jul 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants