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

The conditional validation on required does not show until the input is edited and then emptied #532

Closed
farahnahle opened this issue Oct 26, 2021 · 5 comments

Comments

@farahnahle
Copy link

farahnahle commented Oct 26, 2021

Describe the bug

The conditional validation on required does not show until the input is edited and then emptied. I am using Nested FormGroups and the check is on a nested value.

Expected Behavior

A field to be required when another input is not empty. The error is only showing if I add a letter and delete it.

To Reproduce

https://stackblitz.com/edit/custom-validation-angular-reactive-form-with-rxweb-wljh2z?file=src/app/app.component.html

Url (stackblitz or plunker or other)

same as this issue:

https://stackoverflow.com/questions/67619122/rxweb-validation-not-automatically-setting-fields-as-required-reactive-forms-v

Package Version

@rxweb/@

@ajayojha
Copy link
Member

@farahnahle would be great if you share the stackblitz example of the stated issue.

@farahnahle
Copy link
Author

farahnahle commented Oct 27, 2021

Sure. I reproduced the issue here:
https://stackblitz.com/edit/custom-validation-angular-reactive-form-with-rxweb-wljh2z?file=src/app/app.component.html

Expected Result:
If English is not empty --> then arabic and kurdish are required

However, what is happening is the following:
If I fill english both other languages are still optional
If I enter a letter in arabic for instance and delete it --> it will be required
If I empty the english --> arabic will still be required though it shouldn't

@farahnahle
Copy link
Author

farahnahle commented Nov 8, 2021

@ajayojha Any update on this? Where you able to check the stackblitz I shared?

@farahnahle
Copy link
Author

@ajayojha I'm eagerly waiting for your response if there is a fix for my issue.

@ajayojha
Copy link
Member

@farahnahle , Sorry missed checking the provided stackblitz example. I think this is a bit complex to manage the state of dynamically created FormControl for Conditional validation, but I will draft something to make this possible.

Tomorrow, I will update you here on the next course of action.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants