-
Notifications
You must be signed in to change notification settings - Fork 19
Closed
Milestone
Description
This validation is a little aggro.
You shouldn't get screamed at if all you do is blur the field (e.g., to look at the rest of the form if the form is longer). My first thought is that we can simply not validate on blur until the field (or the form?) is empty. I kind of doubt we can implement this on the form itself using mode because the options are pretty flat — submit, blur, change, touched, all. However, it would be pretty do at the display layer: regardless of whether there is an error on the field, only show it under certain conditions, which we can pull from the field and form state.
console/app/components/form/fields/TextField.tsx
Lines 83 to 100 in d41e40f
| render={({ field, fieldState: { error } }) => { | |
| return ( | |
| <> | |
| <UITextField | |
| title={label} | |
| type={type} | |
| error={!!error} | |
| aria-labelledby={cn(`${id}-label`, { | |
| [`${id}-help-text`]: !!description, | |
| })} | |
| aria-describedby={description ? `${id}-label-tip` : undefined} | |
| {...field} | |
| {...props} | |
| /> | |
| <ErrorMessage error={error} label={label} /> | |
| </> | |
| ) | |
| }} |
Metadata
Metadata
Assignees
Labels
No labels
