1

Is it possible to access customAttributes on a FreeForm field?

Currently attempting to do this via:

{% for row in form %}
  {% for field in row %}
    {{ dump(field.customAttributes) }}
  {% endfor %}
{% endfor %}

Where form is a FreeForm object.

Currently I'm getting an error that indicates that attribute does not exist or I can't access it.

  • > Sorry this isn't a comment, i don't have enough rep to comment yet. I'm having this issue right now. I need to show/hide a field's parent "row" based on another fields value (the rules in the conditional editor aren't thorough enough in this case). I've added an input attribute to a field that I want to control the row of but field.inputAttributes or field.customAttributes.inputAttributes isn't available like the docs make it seem like it would be. Errors I'm seeing are Neither the property – Harry Harrison Feb 13 at 12:07
1

You'll need to access the properties individually like this, assuming you've set them on the Form object:

{{ form.customAttributes.rowClass }}
{{ form.customAttributes.columnClass }}
{{ form.customAttributes.inputClass }}
Etc...

https://solspace.com/craft/freeform/docs/form/#prop-custom-attributes

  • Roger that, what about properties set on the field object? – Philip Zaengle Jan 16 at 3:49
  • Can you think of a use-case where you would apply attributes to a field but then render those manually? Or apply it to the field object instead of form object? – Solspace Jan 17 at 3:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.