Skip to content

isRequired validator doesn't support numeric values #328

@maxceem

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions