Rule doesn't work for checkbox #1395
-
What happened?I have testform with 1 checkbox, 1 dropdown and a numbers field. My checkbox uses the following code: {% case 'checkbox' %}
<div class="c-form__field c-form__field--options" data-field-container="{{ field.handle }}">
<div class="c-form__field-stack">
<div class="c-form__field c-form__field--option" >
{{ field.renderInput({
attributes: {
input: {
class: "c-form__input"
}
}
}) }}
<label class="c-form__option__label" for="{{ field.idAttribute }}">{{ field.label|t('freeform') }}{% if not field.required %} {{ '(optional)'|t('freeform') }}{% endif %}</label>
</div>
</div>
{{ field.renderInstructions({
attributes: {
instructions: {
class: "c-form__field__instruction",
},
}
}) }}
{{ field.renderErrors({
errorClass: 'c-form__errors'
}) }}
</div> When I inspect the page and look at the How can we reproduce this?
VersionsFreeform Pro 5.3.4 |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Hi @JulieVelghe, Did you by chance, originally have a different rule set for this condition? For example, did you have something set up like this: And then switch it to something like this: If so, can you click onto the (or any) one you had set before and be sure to clear out the old values, then set back to It shouldn't do this, but in my testing, this is how I was able to duplicate the issue. Once I removed the We'll look into resolving that issue though. |
Beta Was this translation helpful? Give feedback.
-
Hi @kjmartens , I did not have such a setup, it was immediately the checked rule. |
Beta Was this translation helpful? Give feedback.
-
Hi @JulieVelghe, It seems that you're rendering the field container manually. I would advise not doing that, but instead pass in your classes to the container manually. So instead of this: <div class="c-form__field c-form__field--options" data-field-container="{{ field.handle }}"> do this: {{ field.renderContainerOpeningTag({
attributes: {
class: "c-form__field c-form__field--options"
}
}) }}
<!-- ... your code here -->
{{ field.renderContainerClosingTag }} This lets you utilize the attribute editor in the builder, as well as make sure that you always get relevant attributes added to the field. In this case you need a |
Beta Was this translation helpful? Give feedback.
Hi @JulieVelghe,
It seems that you're rendering the field container manually. I would advise not doing that, but instead pass in your classes to the container manually.
So instead of this:
do this:
This lets you utilize the attribute editor in the builder, as well as make sure that you always get relevant attributes added to the field.
In this case you need a
data-field-type="checkbox"
attribute for your checkb…