> For the complete documentation index, see [llms.txt](https://attr.sygnal.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://attr.sygnal.com/sa5-forms/custom-form-submit-button.md).

# Custom Form Submit Button

**Webflow's form submit button is a "closed" element that doesn't easily allow for customization such as adding an icon.**

To work around this, you can create your own "button" from a DIV containing whatever icons and text you like, and then use script and a click handler to submit your form.

{% hint style="info" %}
We'll add this formally to the SA5 lib but for now, here's an approach.&#x20;
{% endhint %}

Here's a simple implementation;

## Setup Notes

1. Create your custom button however you like
2. Add the `wfu-form-submit` attribute to the outer button
3. Add this script to the before-/body section of the page(s) which have your forms;&#x20;

```html
  <script>
    document.addEventListener('DOMContentLoaded', function() {
      document.querySelectorAll('[wfu-form-submit]').forEach(function(button) {
        button.addEventListener('click', function() {
          const form = button.closest('form');
          if (form) {
            // Attempt to submit the form, triggering built-in validation
            if (form.checkValidity()) {
              form.submit();
            } else {
              // If form is invalid, trigger HTML5 form validation UI
              form.reportValidity();
            }
          } else {
            console.error('No form found to submit.');
          }
        });
      });
    });
  </script>
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://attr.sygnal.com/sa5-forms/custom-form-submit-button.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
