Skip to content
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

issue: FormState IsValid is causing issues with shouldUseNativeValidation #10064

Closed
1 task done
jamierytlewski opened this issue Mar 8, 2023 · 3 comments
Closed
1 task done
Labels
bug Something isn't working

Comments

@jamierytlewski
Copy link

Version Number

7.43.5

Codesandbox/Expo snack

https://codesandbox.io/s/cranky-dewdney-jlzt4b?file=/src/App.tsx

Steps to reproduce

  1. Go to the link.
  2. Open the console window
  3. Put in numbers up to 5 (as it's a US Zip Code)
  4. Watch it go false, false, false, false, true
  5. Comment that section and uncomment the section with isValid
  6. Watch that it never hits true. If you change the maxLength to 6 and put in 6 numbers and backspace you get it to show true.

Expected behaviour

I'm expecting that if I'm using isValid that it should work without using isValid

What browsers are you seeing the problem on?

Chrome, Edge

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@jamierytlewski
Copy link
Author

If there's a better way to check if it's valid before I make the call that will work. I'm also figuring out that once it's been submitted is when the error also happens.

@jamierytlewski
Copy link
Author

Actually I don't really want to change the ticket as it was originally setup this way, but one way I figured around this possibly is I've tried to put in custom messages.

So I was doing {minLength: {value: 5, message: 'Message'}}. It works great until you submit. After submit it doesn't work. If I get rid of the custom message it works as expected, but now I'm getting default messages.

@bluebill1049 bluebill1049 added status: under investigation aware of this issue and pending for investigation bug Something isn't working and removed status: under investigation aware of this issue and pending for investigation labels Mar 8, 2023
@jamierytlewski
Copy link
Author

This is still not fixed. I added on to it, maybe it should've been a different issue, but here's the code again with some modifications:

https://codesandbox.io/s/cranky-dewdney-jlzt4b?file=/src/App.tsx

On the origin you can see I have messages on the validation rules and on the destination there are no messages. After you fill out the form and hit submit. It submits properly. Then when you try and change the origin zip code again it fails. It works if I ask for the specific type of validation rule.

image

The reason we are doing this is that we are creating a pricing tool. So someone picks a destination zip code and an origin zip code. They fill out other data and hit submit. Well sometimes they will want to change the zip codes without change the other information. So right now it's not triggering that the zip code is valid.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants