A few questions about the form

Is it possible to send the form without a redirect page? If Yes, how to do a dynamic submit button of the form, i.e. for example after pressing the word Submit was changed on the Sending and Sent.
For button may need to use ajax or api, but how and where to start?
Like, if you also care about these issues. )))

Ok, i had never actually tested this but thought it would work. It does require a fix to the form plugin which i’ll commit/release soon:

  1. my page (form/ajax/form.md):


title: Ajax Form
name: ajax-form
action: /form/ajax.json

        label: Name
        size: small
        placeholder: 'Enter your name'
        type: text
            required: true
        type: submit
        value: Submit
    message: 'Thank you from your Smallform Feedback!'

As the response is HTML an we just update the DIV with the message response, it needs a change to the `form.json.twig`:

{% extends ‘partials/base.html.twig’ %}

{% block content %}

{{ content|raw }}
{% include "forms/form.html.twig" %}

{% endblock %}

Obviosly left my debug comment in there :slight_smile:

Ok. This is interesting.

I actually wrote this up in the learn docs and added the ability to provide a unique form twig template that actually makes this process better. This is available in Forms 2.3.0.