Skip to content

Conversation

@ldaspt
Copy link

@ldaspt ldaspt commented Jun 3, 2025

In the custom form theme block checkbox_radio_label, the field validity is incorrectly determined using form.parent.vars.valid. This checks the validity of the entire parent form, not the individual field.

Fix #31

Current behavior

{% if checked and form.parent.vars.valid == false %}
    {% set valid = false %}
{% endif %}

Even if the current field has no validation error, it is marked as invalid if any other field in the parent form is invalid.

Expected behavior

The validity check should be scoped to the current field only.

🛠️ Impact

This causes incorrect error styling on checkbox or radio labels, even when they are valid, as soon as any unrelated form field fails validation.

@j0r1s
Copy link

j0r1s commented Oct 27, 2025

just as a follow up, I have overridden the checkbox_radio_label and switch_label blocks with your fix on one of my project and this seems to fix the issue well !

thanks a lot

@ker0x
Copy link
Member

ker0x commented Nov 26, 2025

Closing as it has been fixed in #42 / #43 !

@ker0x ker0x closed this Nov 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Strange behavior of checkbox / switch fields

3 participants