Skip to content

isRequired validator doesn't support numeric values #328

Open

Description

@maxceem

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.

Activity

  1. vikasrohit commented on Aug 22, 2019

    @vikasrohit

    Good catch.

  2. vikasrohit commented on Aug 22, 2019

    @vikasrohit

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

  3. maxceem commented on Aug 22, 2019

    @maxceem
    Author

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions