Revalidate when children changes #1139
-
Hi, I was wondering if you guys had any better approach/suggestion. I have a form with a Select component. My issue, is when the new fields render and appear in the form and The only way I found to make this work was to add a If you have any ideas or better approach let me know. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
Hi @simplecommerce. Technically, it shouldn't matter if a field is visible or not - the user completed it by successfully validating the data. In other words, the visibility of a field should not affect its validation. What we do in our Form Builder is a schema that is aware of visibility, i.e., both the validation and rendering use the same logic. This makes this problem non-existent as if a field should not be visible, it is not validated and it gets validated if it is. The last part is that the conditions may include only one source of variables - the state of the form (i.e., values of other inputs). What are the conditions you show/hide your fields on? If they rely only on the model, it should be pretty straightforward. |
Beta Was this translation helpful? Give feedback.
Hi @simplecommerce. Technically, it shouldn't matter if a field is visible or not - the user completed it by successfully validating the data. In other words, the visibility of a field should not affect its validation.
What we do in our Form Builder is a schema that is aware of visibility, i.e., both the validation and rendering use the same logic. This makes this problem non-existent as if a field should not be visible, it is not validated and it gets validated if it is. The last part is that the conditions may include only one source of variables - the state of the form (i.e., values of other inputs).
What are the conditions you show/hide your fields on? If they rely only on the model, …