-
-
Notifications
You must be signed in to change notification settings - Fork 503
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
How to fire error if dropdown are not filled (validate tree) #977
Comments
@ukrbublik Any answer on this issue ? This would really help me! |
@FlorianRuen Thanks for the feature request!
You can trigger tree validation that will not remove incomplete rules, but validate rules and log warnings in the console. You can use a workaround to catch errors from console:
I should improve this function to return errors rather than logging. (and not forcing a developer to call
|
@ukrbublik Thanks for your answer, I was working on a function to do this, but it wasn't optimized, so this workaround should be better
For others dots, I will test using this workaround, maybe I create a strange behavior, I will test again, and add a new comment based on the tests |
@ukrbublik I test your workaround, but I think, I got the same error that i mentionned with In this case, If i use the workaround, the array Same for this rule, without the value, the array I think validateTree works only if we define some validator in config, but if we don't (or can't) define some validator functions, the validateTree will not work anymore (for example, in the first image, I can't define a validator function on source) |
Oh, now I see, you're right. |
Do you need just indexes? Like first group, 5th rule? |
I'll prioritize this issue |
Related #781 |
You can also add the rule/group id, it can help in some case. For me, it's more user fridently using group/rule number to fix the problem. Ideally, all of the things that need to be validated:
This function will be very useful when integrating into a form! |
@ukrbublik Do you have any update on this issue ? thanks a lot |
I'm using this library to generate a json logic that will be analyzed using golang library, but I got some concerns on validation
In all these cases, I want to fire an error message, because rules are incomplete.
What I tried:
Utils.ValidateTree()
always clean the tree, even if everything is filled (maybe a bug ?) and compare the tree before the validate function and after. If there is a difference, we can fire an error messageUtils.TreeUtils.getTreeBadFields
return an empty listUtils.TreeUtils.isEmptyTree
can't work, because I want to allow empty tree, but not incomplete oneIn this case, the function
Utils.ValidateTree()
remove the rule@ukrbublik
There is a way to detect incomplete rules in a Tree, and fire an error if there is at least one ?
Thanks for your help!
The text was updated successfully, but these errors were encountered: