-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In first line of a Bolt form, there is a duplicate 'name=' #269
Comments
What does your |
The config file does contain only once the name of the form and that is 'contact'. But why does the form in the source code contains two times this name? When visiting this url, you can look at the source code:
|
Hmm. Are you using a custom template? What does your embed twig function look like? |
The only thing I've changed is the appearance of the message that the recipient receives. And in my templates I call the form with An example of the website is beta.hetfestijn.nl |
It's a bug - in line https://github.com/bolt/boltforms/blob/4.2/templates/form/_form_theme.twig#L326 the form renders the form name, and all attributes .. where the name probably is repeated as a key in {%- block form_start -%}
{%- do form.setMethodRendered() -%}
{% set method = method|upper %}
{%- if method in ["GET", "POST"] -%}
{% set form_method = method %}
{%- else -%}
{% set form_method = "POST" %}
{%- endif -%}
<form name="{{ name }}"
method="{{ form_method|lower }}"
{% if action != '' %} action="{{ action }}"{% endif %}
{% for attrname, attrvalue in attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}
{% if multipart %} enctype="multipart/form-data"{% endif %}>
{%- if form_method != method -%}
<input type="hidden" name="_method" value="{{ method }}" />
{%- endif -%}
{%- endblock form_start -%} So this part repeats the name: {% for attrname, attrvalue in attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %} The quickest fix is probably the fowlling:
{%- block form_start -%}
{%- do form.setMethodRendered() -%}
{% set method = method|upper %}
{%- if method in ["GET", "POST"] -%}
{% set form_method = method %}
{%- else -%}
{% set form_method = "POST" %}
{%- endif -%}
<form
method="{{ form_method|lower }}"
{% if action != '' %} action="{{ action }}"{% endif %}
{% for attrname, attrvalue in attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}
{% if multipart %} enctype="multipart/form-data"{% endif %}>
{%- if form_method != method -%}
<input type="hidden" name="_method" value="{{ method }}" />
{%- endif -%}
{%- endblock form_start -%} Please double check if this works, because I have not tested this. |
I'm using the newest version of Boltforms. I noticed in the first line of code of the form, the name attribute is mentioned twice. What is the purpose of that? According to a html validator, it is an error and I want to remove it. What file do I need to edit for this?
The text was updated successfully, but these errors were encountered: