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

Why there is check for validity.valid if all rules came true? #40

Open
matej116 opened this issue Dec 15, 2017 · 0 comments
Open

Why there is check for validity.valid if all rules came true? #40

matej116 opened this issue Dec 15, 2017 · 0 comments

Comments

@matej116
Copy link
Contributor

There is check for validity.valid if elem.type === 'number' in the end of validateControl() function, which 1) has untranslatable error message and 2) is causing unexpected errors if there is condition rule and another rule after it.

More explanation for 2):

  • create input of type number

  • call ->addRule(Form::MIN, 0)

  • call ->addConditionOn( , )->setRequired();

  • call ->addRule(Form::MAX, 10)

  • let the form render, fill value bigger than 10

  • with this setup, the element has set both min and max properties, rendering validity.valid to be false for some value > 10. Calling validateControl() in this case would cause recursive call (because of the condition beeing true) and the condition for validity.valid in the end of nested call validateControl() fails.

Please corrrect me if I am wrong, but I am seeing the check for validity.valid useless.

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

No branches or pull requests

1 participant