Skip to content

Conditionally hidden field in repeater fails validation #2874

Description

@pbright

Describe the bug

If there is a field that requires a specific data format (eg. a number field) inside a repeater and that field is conditionally hidden, if a previous row in the repeater meets the condition for the field to be visible then the subsequent rows also have that field validated even if they do not meet the condition. Since the data is blank, this causes a validation error.

Steps to reproduce

Create a form with a repeater field, where each row has a checkbox / radio buttons and a number field which is shown conditionally based on the checkbox / radio button.

Image

When entering data in the form, cause the conditional field to be visible for the first row in the repeater field, but not for the second.

Image

The form fails validation due to the blank data in the conditionally hidden field in the second row.

Image

Form settings

  • Multi-page form: No
  • Submission Method: Ajax
  • Client-side Validation: Yes
  • Custom Form Templates: No

Craft CMS version

5.10.8.1

Plugin version

3.1.30

Multi-site?

No

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions