generated from hackforla/.github-hackforla-base-repo-template
-
-
Notifications
You must be signed in to change notification settings - Fork 91
Open
Labels
Milestone
Description
Overview
Part of #1481
The react-hook-form
library has an option to pass custom validations. That's quite handy because we already have custom validations made previously from some of our existing pull requests. ValidatedTextField
needs to be adapted to use these custom validations, applying the validators properly while being looped over via Array.map()
.
// example simpleInput
{
...
name: blah
value: blah
validators: [ // array of validation function objects
{
func: mustContainBlah,
params: undefined, // this section to be used if custom parameters
// need to be passed to the validaiton function
message: "This field must contain the word 'blah'",
},
],
...
}
Action Items
- Adapt
ValidatedTextField
to apply custom valdations into thevalidate
portion of theregister
function fromreact-hook-form
Resources
React Hook Form Register - search for the validate section
- This issue is part of the epic: Epic: Improve integrations for react-hook-form across components #1481
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
In progress