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

validateIf based on other fields #4

Closed
joshua1 opened this issue Sep 15, 2022 · 2 comments
Closed

validateIf based on other fields #4

joshua1 opened this issue Sep 15, 2022 · 2 comments

Comments

@joshua1
Copy link

joshua1 commented Sep 15, 2022

Hi , I came upon this lib and find it interesting. I want to suggest that either validateIf be extended to take other fields in the form into consideration or introduce a validateWhen , which validates , when conditions based on other fields in the form are met

@Alexandre-Fernandez
Copy link
Owner

Alexandre-Fernandez commented Sep 16, 2022

Hi @joshua1, thanks for using svelidate.

validateIf should take other fields in the form into consideration

I think I didn't update the documentation but this may be already implemented.
You should be getting the form as the second parameter validateIf((fieldValue, form) => form.field.value.length > 1), can you please try it ? I'll update the doc afterwards.

introduce a validateWhen , which validates , when conditions based on other fields in the form are met

Isn't that the same as your first suggestion ?

@joshua1
Copy link
Author

joshua1 commented Sep 16, 2022

@Alexandre-Fernandez I will give it a try and close this . Thanks @Alexandre-Fernandez

@joshua1 joshua1 closed this as completed Sep 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants