Field.render overrides not working #1117
-
Describe the bugUsing field.render() with custom overrides according to the documentation here does not seem to output any of the defined overrides, only the default attributes and values. We are trying to update our old form template to work with the new Freeforms versions. We have a switch that outputs different styling and attributes for few specific field types, and at the end we have a general field.render() that works as a fallback for the rest of the field types. Previously it was being done like this:
Steps to reproduceExpectation: Outputting field overrides with the help of the example below adds a class attribute with value "freeform-input" etc. to the rendered field {{ field.render({ Reality: Field gets output with only default attributes and values, similarly to how it would if one would simply use {{ field.render() }} without added overrides. Craft CMS version Plugin version Additional context Partially related issue: #995 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi @joelstrom, Sorry about this... we are still making some updates to our documentation. You'll want to check out the Template Overrides documentation for this instead: You have a couple of options now: At Form level:https://docs.solspace.com/craft/freeform/v5/templates/formatting/#full-example {{ freeform.form("myFormHandle", {
attributes: {
novalidate: true,
row: {
class: "row",
},
},
fields: {
"@global": {
attributes: {
input: { class: "input-class" },
label: { class: "label-class" },
},
},
"@dropdown": {
attributes: {
input: { "+class": "select fullwidth" },
},
},
"@checkboxes, @multiple-select": {
instructions: "Select all that apply.",
},
":required": {
attributes: {
label: { "+class": "form-required" },
},
},
},
}).render() }} At Field level:https://docs.solspace.com/craft/freeform/v5/templates/formatting/#on-all-parts-of-the-fields {{ field.render({
label: "My Field Label Override",
instructions: "My field instructions override.",
value: "my field value override",
attributes: {
container: {
class: "container",
},
input: {
novalidate: true,
class: "input-element",
},
label: {
class: "label",
},
instructions: {
class: "instructions",
},
error: {
class: "error-block",
},
}
}) }} Please let me know if you have any further questions. 🙂 |
Beta Was this translation helpful? Give feedback.
-
Thank you for the quick response! We should be able to proceed with this. |
Beta Was this translation helpful? Give feedback.
Hi @joelstrom,
Sorry about this... we are still making some updates to our documentation. You'll want to check out the Template Overrides documentation for this instead:
https://docs.solspace.com/craft/freeform/v5/templates/formatting/#template-overrides
You have a couple of options now:
At Form level:
https://docs.solspace.com/craft/freeform/v5/templates/formatting/#full-example