getgrav / grav

Modern, Crazy Fast, Ridiculously Easy and Amazingly Powerful Flat-File CMS powered by PHP, Markdown, Twig, and Symfony

Home Page:https://getgrav.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Modify form input names

derjoergbode opened this issue · comments

Hello everyone,
I've been trying for hours to find out how I can change the name of a field within a form.

In a regular form, the name is rendered in a data[] array. But I can't use that because I want to make a POST request to a newsletter software that explicitly searches for certain names in the form for further processing.

I have already found a solution for a hidden field by copying the template and then using

{% if field.naked %}
{% set field_name = field.name |fieldName %}
{% else %}
{% set field_name = (scope ~ field.name)|fieldName %}
{% endif %}

have built in. This also works as I need it to. However, I can't figure out how and where to realise this with other fields such as text or email.

Is there a way that the names can be defined in an input field?

Translated with DeepL.com (free version)