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

isRequired validator doesn't support numeric values #328

Open
maxceem opened this issue Aug 22, 2019 · 3 comments
Open

isRequired validator doesn't support numeric values #328

maxceem opened this issue Aug 22, 2019 · 3 comments

Comments

@maxceem
Copy link
Collaborator

maxceem commented Aug 22, 2019

If we have TCFormFields.TextInput component with type="number" and we use isRequired validate rule like validations={ isRequired: true }, then on rendering such component with value which is numerical there would be error in console:

index.js?15f1:23 Uncaught TypeError: value.trim is not a function
    at Object.eval [as isRequired]

The reason for this is code in this file https://github.com/appirio-tech/react-components/blob/feature/connectv2/components/Formsy/index.js. It applies trim() method to the value without prior checking if value is a string.

@vikasrohit
Copy link

Good catch.

@vikasrohit
Copy link

@maxceem are you fixing it along with your other changes or should we mark it for our next bug bash?

@maxceem
Copy link
Collaborator Author

maxceem commented Aug 22, 2019

Fixed via PR #329

Tested it locally works good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants