Skip to content

Commit 517e64e

Browse files
committed
Changed example (first version copied from redux form) to minLength, maxLength example
1 parent cc38550 commit 517e64e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313

1414
You don't want to declare field-level validation like this with your form framework:
1515

16-
<Field name="age" validate={[required, number, minValue13]} />
16+
<Field name="username" validate={[required, minLength2, maxLength20]} />
1717

1818
Instead you want to write:
1919

20-
<NumberField name="age" required min={13} />
20+
<Field name="username" required minLength={2} maxLength={20} />
2121

2222
### Form framework needed
2323

@@ -39,7 +39,7 @@ Enhance a Formik field component with validation (should be done once per applic
3939

4040
Use your enhanced components in your form:
4141

42-
<TextField type="text" name="username" required minLength={2} maxLength={20} />
42+
<TextField name="username" required minLength={2} maxLength={20} />
4343

4444
A complete example can be found in [examples/formik](https://github.com/pstrh/react-constraint-validation/blob/master/examples/formik/src/components/FieldLevelValidation.tsx).
4545

0 commit comments

Comments
 (0)