Replies: 2 comments 5 replies
-
provide a csb |
Beta Was this translation helpful? Give feedback.
2 replies
-
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi @bluebill1049,
We've developed a dynamic form that contains multiple select boxes, text, and textarea fields.
When the user changes the value of the end year, an error message should be displayed If the start date is lesser than the end date. For this I'm using controller rules validation function as below,
<Controller
as={}
defaultValue={selectedValue}
options={optionSet}
className={className}
name={name}
isMulti={isMulti}
isClearable={isClearable}
isSearchable={isSearchable}
control={control}
placeholder={label}
isLoading={loading}
rules={{
required: requiredData?.fields?.value?.value || false,
validate: () => dataValidator(),
}}
and in dataValidator function, based on the start and end date, I'm using clearErrors function to remove all validation from start month, start year and end month.
Issue: After using clearErrors(['startMonth', 'startYear', 'endMonth', 'endYear']), the formState.isValid is not set to true.
Please help me to identify the issue.
Using React: 16.15.1
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions