javascript
Enter only number field validation redux form
You can apply the number-only input field validation by creating a function that can check if the given value is a number or not.
const numberValidator = value => value && isNaN(Number(value)) ? 'Must be a number' : undefined
<Field
name="totalScore"
type="number"
component={renderField}
label="Total Score"
validate={[ numberValidator ]}
/>
Was this helpful?
Similar Posts
- Email Validation on Field Redux Form
- Apply required field validation on redux form fields
- Apply multiple validation on same field redux form
- Radio Button Input field in Redux Form
- Create a simple Login Form using Redux Form
- Call custom method on form submit redux form
- Add redux form reducer to store