[5.x]: Disable automatic button rendering #1073
-
In previous versions, I was able to detect the button as a field type, to render my own custom buttons (see code below). Please give an option to disable the automatic rendering of the button. {% switch field.type %}
{% case 'submit' or 'save' %}
<div class="flex justify-end">
{% include '_inc/helpers/button.twig' with {
element: 'button',
type: 'submit',
content: field.label
} %}
</div> |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hi @mikesnoeren, You are correct that this has changed in Freeform 5, but there is a way to disable the automatic button rendering and set it yourself. 🙂 You can see the options available in the documentation, but you might likely wish to go this route: {{ form.renderTag({
returnUrl: "contact/success",
disable: ["submitButtons"]
}) }}
{# Your fields #}
{% set page = form.pages.current %}
<button {{ page.buttons.submitRenderProps({ 'data-optional': 'attributes here' }) }}>
Submit
</button>
{% if form.pages.current.buttons.back %}
<button {{ page.buttons.backRenderProps }}>
Back
</button>
{% endif %}
{% if form.pages.current.buttons.save %}
<button {{ page.buttons.saveRenderProps }}>
Save
</button>
{% endif %}
{{ form.renderClosingTag }} https://docs.solspace.com/craft/freeform/v5/templates/formatting/#submit-button-customization |
Beta Was this translation helpful? Give feedback.
-
This seems to not work for multi page forms. At page 2 no buttons are shown. |
Beta Was this translation helpful? Give feedback.
Hi @mikesnoeren,
You are correct that this has changed in Freeform 5, but there is a way to disable the automatic button rendering and set it yourself. 🙂
You can see the options available in the documentation, but you might likely wish to go this route: