Form Backend
A no code way to collect form submissions data.
To start using Basin to power your web forms, you'll need the following:
- A Basin account
- A HMTL form
- A unique form endpoint (generated by Basin)
- Basic knowledge of Javascript Optional
Creating an HTML form
In order to use Basin, you're going to need an HTML form. If you don't already have one, you can start with the following example:
<form action="#" method="POST">
<label for="email-address">Email Address<label>
<input type="email" id="email" name="email"required>
<button type="submit">Submit<button>
</form>
Theaction="#"
determines where submitted data will be sent
for processing. Developers often use something like the following:
<form action="https://coolsite.com/form.php" method="POST">
<label for="email-address">Email Address</label>
<input type="email" id="email" name="email" required>
<button type="submit">Submit</button>
</form>
The downside to this method is the need to write backend code (like Nodejs, PHP, Python, Ruby, Perl, etc.) to process the data once it hits the URL. But with Basin, you can out that development time by using a unique URL endpoint to handle all the backend data processing for you. They look like this:
https://usebasin.com/f/1a2b3c4d5e6f
Creating a form endpoint
After creating your Basin account, you should see a button to "Create a Form" at the top of you dashboard page. Once a form is created, you can click on the form name to open the dashboard for each specific form.
When creating a new form endpoint, the name field is required. Setting a custom redirect URL is optional and only avaliable to customers on paid plans. If you leave this field blank, people who submit to your form will see our default submission success page below.
After creating an endpoint, go to the Setup page in your dashboard and simply copy/paste the URL endpoint into your form's action attribute. If you used the example form above, it should now look like this:
<form action="https://usebasin.com/f/1a2b3c4d5e6f" method="POST">
<label for="email-address">Email Address</label>
<input type="email" id="email" name="email" required>
<button type="submit">Submit</button>
</form>
And that's it. You're all set to receive submissions.
Helpful Tips
- Every input field must have the
name
attribute defined.
<input type="email" name="email">
<input type="text" name="name">
<input type="text" name="phone">
<input type="text" name="website">
-
Requests using javascript are supported by default in Basin. You are able to set
content-type
:json
,form-data
, orx-www-form-urlencoded
. If you're using a vanilla HTML form that doesn't include any special functions, don't worry about this. -
If you want to collect data using
json
as the format, then you must set theAccept
header toapplication/json
.