Hi,
There is a form, and it should be possible to submit it more than one time,
But when a user tries to submit the form more then one time it appears an error message “This form has already been submitted.”
@pavlo, Not knowing the code and its configuration options, it is hard to tell…
I see a nonce is being used in this form which will probably be tested on submission to prevent resubmission of the same form. Which makes sense, but I guess you will have a specific use-case that warrants multiple submits of the same form?
In the following solution, you can submit a form, return to the same page with a “Thank you!” message above a cleared form and submit again.
Steps I’ve taken:
I used your provided code to create a page /pages/01.contact/form.md
I copied the template user/plugins/form/templates/form.html.twig into the folder /user/themes/quark/templates and included the partial partials/form-messages.html.twig:
{% extends 'partials/base.html.twig' %}
{% block content %}
{{ content|raw }}
{# inserted the messages partial here #}
{% include 'partials/form-messages.html.twig' %}
{% include "forms/form.html.twig" %}
{% endblock %}
From the definition of the form, I removed template: form-messages.
This field tells the message action which template to use and now defaults back to form ( which points to form.html.twig) to get the original page layout back.
To clear the form, I added as last action: reset: true.
Now you can save the form and the original page will return with the “Thank you!” message and a new form can be submitted without errors.