Skip to content

Disable validation for elements out of current form #198

Closed
@burdiuz

Description

@burdiuz

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

  1. make own validation cycle asking each field is it valid
  2. change validation event handler in a way that will prevent inactive form fields to be validated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions