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. )))
Thanks.

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):

—html


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

fields:
    name:
        label: Name
        size: small
        placeholder: 'Enter your name'
        type: text
        validate:
            required: true
           
buttons: 
    submit:
        type: submit
        value: Submit
        
process:
    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.