-
Notifications
You must be signed in to change notification settings - Fork 173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
validate one field based on another field value #405
Comments
Are you using paired validation ??? https://teslamotors.github.io/informed/?path=/story/validation--paired-validation |
you should not be trying to use useField or useFieldState at this point. Create your custom inputs once with useField and then you should never be touching that hook again. |
<Input
name="password"
id="notify-password"
validate={validatePassword}
validateOnChange
validateWhen={['confirmPassword']}
/>
<Input
name="confirmPassword"
id="notify-confirm-password"
validate={validateConfim}
validateOnChange
validateWhen={['password']}
/>
<button type="submit">Submit</button>
</Form>; |
@joepuzzo We have used |
did you do exactly as the docs show? Can you recreate issue in a code sandbox https://teslamotors.github.io/informed/?path=/story/playground--format-example |
https://codesandbox.io/s/validatepaireddate-71b7pt?file=/App.js See this example working ^^^^ |
its working. Thankyou @joepuzzo |
Describe the bug
We have 2 select fields named select_field1 and select_field2 and both are dependent on each other. when select_field1 value is changing, the select_field2 should also be validated and show error message based on validate function. We are passing select_field1 and its value to useField of select_field2, select_field2 component is re rendering when select_field1 value changes, but the select_field2 error value is not getting set.
The text was updated successfully, but these errors were encountered: