Written by: Geoffrey Callaghan
create a contact form with AWS Amplify
Create A Contact Form With Aws Amplify
Creating a contact form with AWS Amplify using FabForm involves setting up your HTML form, deploying it using AWS Amplify, and configuring FabForm to handle the form submissions. Here’s a detailed guide to help you through the process:
Create a simple HTML file for your contact form. This file will be deployed using AWS Amplify.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Contact Form</title>
</head>
<body>
<form action="https://fabform.io/f/YOUR_FORM_ID" method="POST">
<label for="name">Name:</label>
<input type="text" id="name" name="name" required><br>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required><br>
<label for="message">Message:</label>
<textarea id="message" name="message" required></textarea><br>
<button type="submit">Submit</button>
</form>
</body>
</html>
Replace the YOUR_FORM_ID
in the action
attribute of the form tag with the form ID you copied from FabForm. For example, if your form ID is abc123
, your form tag should look like this:
<form action="https://fabform.io/f/abc123" method="POST">
mkdir contact-form
cd contact-form
index.html
file with your form code.touch index.html
index.html
.npm install -g @aws-amplify/cli
amplify configure
amplify init
amplify add hosting
Select the hosting options and continue with the prompts.
amplify publish
After deployment, navigate to the URL provided by AWS Amplify to find your contact form. Test the form to ensure submissions are being sent to FabForm correctly.
redirect
input field in your form:<input type="hidden" name="redirect" value="https://youramplifyapp.com/thank-you">
Here’s how your final HTML form might look:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Contact Form</title>
</head>
<body>
<form action="https://fabform.io/f/abc123" method="POST">
<label for="name">Name:</label>
<input type="text" id="name" name="name" required><br>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required><br>
<label for="message">Message:</label>
<textarea id="message" name="message" required></textarea><br>
<input type="hidden" name="redirect" value="https://youramplifyapp.com/thank-you">
<button type="submit">Submit</button>
</form>
</body>
</html>
By following these steps, you should be able to create a contact form with AWS Amplify using FabForm successfully.