You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi!
I have 2 form settings for Canada and US addresses, they are identical except of State/Province enumeration. Both forms are connected to same model object. When user switches country, specific form is shown. When I launch validation with default country, it works fine. But if I select another country, so new settings loaded and new form elements added -- it breaks validation because somehow validation goes through all form fields(CA and US have different enumerations for their states/provinces, so value will be invalid for one of them), for both countries even if they its not visible and should not be validated at all. This is confusing because selected country fiends show all fields valid but in total validation fails and "invalid" fields are being nullified with validator.
For now I found 2 solutions
make own validation cycle asking each field is it valid
change validation event handler in a way that will prevent inactive form fields to be validated.
The text was updated successfully, but these errors were encountered:
I don't know if proper oneOf-support is implemented for the form yet, but with regards to json-schema and tv4 (the validator) a oneOf-statement in the address could be used, stating that it either should be country "Canada" and matching a certain province, or country "USA"... In either case, the validator shouldn't require a field to be set if it isn't marked as "required" in the schema.
Hi!
I have 2 form settings for Canada and US addresses, they are identical except of State/Province enumeration. Both forms are connected to same model object. When user switches country, specific form is shown. When I launch validation with default country, it works fine. But if I select another country, so new settings loaded and new form elements added -- it breaks validation because somehow validation goes through all form fields(CA and US have different enumerations for their states/provinces, so value will be invalid for one of them), for both countries even if they its not visible and should not be validated at all. This is confusing because selected country fiends show all fields valid but in total validation fails and "invalid" fields are being nullified with validator.
For now I found 2 solutions
The text was updated successfully, but these errors were encountered: