# Quick Start

Collect your first form submission in just 5 minutes.

## Create a Project

To get started, [create a new project](https://betterform.io/projects/new) with the URL of the website where you want to accept submissions. Later, there will be a section on testing for a development setup.

## Add BetterForm to Code

Next, copy and paste the script tag into any page where you want BetterForm to capture submissions. We strongly recommend leaving async and defer for optimized website performance. We will still capture any forms submitted to those pages!

{% tabs %}
{% tab title="Embed Script" %}

```html
<script async defer src="https://betterform.io/embed.js"></script>
```

{% endtab %}

{% tab title="React" %}
Coming Soon
{% endtab %}

{% tab title="Ruby on Rails" %}
Coming Soon
{% endtab %}
{% endtabs %}

## Prepare the Form

* To start using a form, add the `betterform` attribute to the form tag in your HTML.

```html
<form betterform>
```

* Next, add a hidden input with a value that corresponds to the name of your form.

```html
 <input type="hidden" name="form[name]" value="Contact Form" />
```

* Finally, add `name` attributes to all inputs that you want to submit to your project.

## Show Submission Status

To indicate to the user if the submission was successful, create HTML elements and add the appropriate attribute to make them visible after submission. The HTML elements must be inside the form to be displayed. Ensure the element is hidden by default with `style="display: none"`.

**Hide by Default:** `style="display: none"`

**✅ Success:** `data-bf-success`

**⛔️ Error:** `data-bf-error`

#### Example with Tailwind

<pre class="language-html"><code class="lang-html"><strong>&#x3C;!-- Success Message -->
</strong>&#x3C;div class="w-full p-4 rounded-md bg-green-50" data-bf-success style="display: none">
  &#x3C;div class="flex">
    &#x3C;div class="flex-shrink-0">
      &#x3C;svg class="w-5 h-5 text-green-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
        &#x3C;path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd">&#x3C;/path>
      &#x3C;/svg>
    &#x3C;/div>
    &#x3C;div class="ml-3">
      &#x3C;p class="text-sm font-medium text-green-800">
        Thank you for reaching out. We will get back to you shortly.
      &#x3C;/p>
    &#x3C;/div>
  &#x3C;/div>
&#x3C;/div>

&#x3C;!-- Error Message -->
&#x3C;div class="w-full p-4 rounded-md bg-red-50" data-bf-error style="display: none">
  &#x3C;div class="flex">
    &#x3C;div class="flex-shrink-0">
      &#x3C;svg class="h-5 w-5 text-red-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
        &#x3C;path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.28 7.22a.75.75 0 00-1.06 1.06L8.94 10l-1.72 1.72a.75.75 0 101.06 1.06L10 11.06l1.72 1.72a.75.75 0 101.06-1.06L11.06 10l1.72-1.72a.75.75 0 00-1.06-1.06L10 8.94 8.28 7.22z" clip-rule="evenodd" />
      &#x3C;/svg>
    &#x3C;/div>
    &#x3C;div class="ml-3">
      &#x3C;p class="text-sm font-medium text-red-800">
        Something with wrong! Please try again later
      &#x3C;/p>
    &#x3C;/div>
  &#x3C;/div>
&#x3C;/div>
</code></pre>

## Development Testing

Submit your form from localhost for development testing. We will validate that everything is set up properly and return success if it works as expected.

{% hint style="success" %}
That's it 🎉 You're ready to launch your website and start receiving submissions.
{% endhint %}

## Example Form

{% tabs %}
{% tab title="contact.html" %}

```html
<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Document</title>
    <script async defer src="https://betterform.io/embed.js"></script>
  </head>
  <body>
    <form betterform>
      <!-- Form Name -->
      <input type="hidden" name="form[name]" value="Contact Form" />
      <input type="text" name="Name" placeholder="Name" />
      <input type="email" name="Email" placeholder="Email" />
      <input
        type="text"
        name="Message"
      />
      <!-- Success Message -->
      <div data-bf-success style="display: none">
        <p>Thank you for reaching out. We will get back to you shortly.</p>
      </div>
      <!-- Error Message Message -->
      <div data-bf-success style="display: none">
        <p>Something with wrong! Please try again later</p>
      </div>
      <button type="submit">Submit</button>
    </form>
  </body>
</html>
```

{% hint style="info" %}
Add semantic name attributes to easily view your submissions

ex: Name, Phone Number, Email, Message
{% endhint %}
{% endtab %}
{% endtabs %}


# Free Project w/ Attribution

We love removing limits as much as you do, so we provide a way to remove all submission limits from your first project with a simple attribution.

## Free Forever

To remove the free plan submission limit, just add our logo with a link to our site. Use the snippet below without modification to ensure our validation works. We want to keep our platform free, accessible, and available to small companies and startups.

{% code lineNumbers="true" %}

```html
<!-- Best on Light Theme -->
<a href="https://betterform.io" data-bf-attribution target="_blank">
  <img
    src="https://betterform.io/betterform-handler-light.svg"
    alt="Handled by betterform"
  />
</a>

<!-- Best on Dark Theme -->
<a href="https://betterform.io" data-bf-attribution target="_blank">
  <img
    src="https://betterform.io/betterform-handler-dark.svg"
    alt="Handled by betterform"
  />
</a>
```

{% endcode %}

![Example of attribution](https://3253194733-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLVAcRuUIjlGpopaeeJhm%2Fuploads%2F6Nod4MLeGQRIBYDIhLtj%2FCleanShot%202022-06-24%20at%2012.19.06%402x.png?alt=media\&token=d443f754-6195-4000-952c-b1602e0b2d35)


# Submission Status

Display part of an HTML page when a submission is successful or if an error occurs!

To indicate to the user if the submission was successful, create HTML elements and add the appropriate attribute to make them visible after submission. The HTML elements must be inside the form to be displayed. Ensure the element is hidden by default with `style="display: none"`.

**Hide by Default:** `style="display: none"`

**✅ Success:** `data-bf-success`

**⛔️ Error:** `data-bf-error`

#### Example with Tailwind

```html
<!-- Success Message -->
<div class="w-full p-4 rounded-md bg-green-50" data-bf-success style="display: none">
  <div class="flex">
    <div class="flex-shrink-0">
      <svg class="w-5 h-5 text-green-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
        <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"></path>
      </svg>
    </div>
    <div class="ml-3">
      <p class="text-sm font-medium text-green-800">
        Thank you for reaching out. We will get back to you shortly.
      </p>
    </div>
  </div>
</div>

<!-- Error Message -->
<div class="w-full p-4 rounded-md bg-red-50" data-bf-error style="display: none">
  <div class="flex">
    <div class="flex-shrink-0">
      <svg class="h-5 w-5 text-red-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
        <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.28 7.22a.75.75 0 00-1.06 1.06L8.94 10l-1.72 1.72a.75.75 0 101.06 1.06L10 11.06l1.72 1.72a.75.75 0 101.06-1.06L11.06 10l1.72-1.72a.75.75 0 00-1.06-1.06L10 8.94 8.28 7.22z" clip-rule="evenodd" />
      </svg>
    </div>
    <div class="ml-3">
      <p class="text-sm font-medium text-red-800">
        Something with wrong! Please try again later
      </p>
    </div>
  </div>
</div>
```


# reCAPTCHA

Add reCAPTCHA to your form to easily filter out spam.

{% hint style="info" %}
We save all messages, marking them as verified or not verified. You can opt to hide unverified messages by default.
{% endhint %}

### Create a reCAPTCHA (v3) Project&#x20;

First, let's create a project on reCAPTCHA and obtain the site and secret keys. We currently support v3 reCAPTCHA.

{% embed url="<https://www.google.com/recaptcha/admin/create>" %}
New Recaptcha Project
{% endembed %}

### Update Project Setting

Update the reCAPTCHA keys on your BetterForm project. This verifies the validity of the submission.

![Edit Project Screen](https://3253194733-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLVAcRuUIjlGpopaeeJhm%2Fuploads%2FLRrgDd9wyZmyqq0efoUq%2FCleanShot%202022-06-18%20at%2012.55.14%402x.png?alt=media\&token=6b6d6844-6115-4315-8517-6ac9d1962058)

### Add reCAPTCHA Code

Add a `data-recaptcha` attribute containing your `site key` to the form tag on your website to enable reCAPTCHA.

```html
<form
  betterform
  data-bf-recaptcha="RECAPTCHA_SITE_KEY"
>
...
</form>
```

{% hint style="success" %}
That's it! All form submissions will now be screened for spam.
{% endhint %}


# Input Fields

This page lists a selection of input fields that are supported. However, it's worth noting that other input fields may also be compatible with our system, even if they are not specifically listed here

{% hint style="info" %}
Add a `name` attribute to all input fields in your form.
{% endhint %}

### Text

This is the default value. Supports a single-line text field. Line-breaks are automatically removed from the input value.

```html
<input type="text" name="Full Name" />
```

### Textarea

The `<textarea>` element is often useful in a form, because it collects user inputs such as comments or reviews. A `<textarea>` can hold an unlimited number of characters, and the text renders in a fixed-width font.

```mathml
<textarea name="Review" rows="4" cols="50"></textarea>
```

### Select

The `<select>` element represents a control that provides a menu of options.

```html
<select name="Plan">
  <option value="Free">Free</option>
  <option value="Premium">Premium</option>
  <option value="Unlimited">Unlimited</option>
</select>
```

### Email

A field for editing an email address. Looks like a text input, but has validation parameters and relevant keyboard in supporting browsers and devices with dynamic keyboards.

```html
<input type="email" name="Email" />
```

### URL

A field for entering any URL. Looks like a text input, but has validation parameters and relevant keyboard in supporting browsers and devices with dynamic keyboards.

```html
<input type="url" name="Website" />
```

### Telephone

A control for entering a phone number. Displays a phone keypad in some devices with dynamic keypads such as smartphones.

```html
<input type="tel" name="Phone Number" />
```

### Number

A control for entering a number. Displays a spinner and adds default validation when supported. Displays a numeric keypad in some devices with dynamic keypads.

```html
<input type="number" name="Quantity" />
```

### Checkbox

A check box allowing single values to be selected/deselected.

```html
<input type="checkbox" name="Receive Emails" />
```

### Hidden

A control that is not displayed but whose value is submitted to the server. Used to add context about current user, and other values you want to be change.

```html
<input type="hidden" name="User" value="user@example.com"  />
```


# Integration Testing

Set up testing to have confidence when deploying to production.

## Overview

All valid submissions from `localhost` will return success, display your `data-success` element and show a console log with the fields received.&#x20;

#### Example console log on development env:

```json
{
    "is_test": true,
    "message": "Submission Setup Correctly",
    "fields": [
        "Name",
        "Email",
        "UID",
        "Issue",
        "Message"
    ]
}
```

## Manual Testing

To ensure a smooth and successful implementation, we recommend testing your setup at least once before deploying it to production. Additionally, it's a good idea to perform another test in the production environment to confirm that your project is properly configured and functioning as expected.

## Automated Testing

The same testing method can be used for running automated tests using Cypress, Capybara, or any other integration testing framework. The API response times should be `~ 5s` at most, but could be higher if you are in a far region from the US servers.


# Road Map

We are committed to making BetterForm simple, reliable, and secure.

### Version 1

Our first version includes 3 free projects with unlimited submissions.

* [x] Projects
* [x] Submissions
* [x] CVS Downloads
* [x] Documentation
* [x] Spam Protection

### Version 2

More features and integration with tiered pricing plans for unlimited project and multiple integrations.

* [ ] Paid Tiers
* [ ] Submission Redundancy
* [ ] File Submissions
* [ ] Integration Tests
* [ ] Support System
* [ ] React Package
* [ ] Slack Integration
* [ ] Zapier Integration

## Request a Feature

{% embed url="<https://betterform.io/feature-request>" %}
Feature Request
{% endembed %}


# Change Log

Our team is hard at work! Here is a list of the features we released and issues we patched.

## Version 1

June 27, 2022

Public product launch with first version

#### Features

* Javascript Embed Code
* Projects
* Message verification with Recaptcha
* Filtering Messages
* CSV Exports

### Version 1.1

June 27, 2022

#### Features

* Added notification preferences
* Update Email Templates

#### Improvements

* Improve wording on create project page

#### Fixes

* Improved Password Reset Screen Styling
* Fixed Sitemap

### Version 1.2

August 1, 2022

#### Features

* Secured sign up and password reset

#### Improvements

* Improved error messages
* Improved styling on setting screen

### Version 1.3

August 19, 2022

#### Improvements

* Added more coverage to testing suite
* Added reliability monitoring&#x20;

### Version 1.4

September 2, 2022

#### Improvements&#x20;

* Changed hosting providers
* Added ability to slow launch features
* Improved speed


