Setting up your form with KwesForms requires setting up your dashboard before actually creating your form. Our setup requirements allow you to use our top-notch form security, our timesaving building components, complete spam protection, and even share the form with other accounts.
The first two steps are to name your project website and form in your KwesForms account.
1. Add a website
On the dashboard page click on the "add a website" button and give your website a name.
2. Add a form
On the next panel give your form a name.
Creating Your Form
From this point forward you start building your form in your code editor using HTML, CSS, our form building components, and whatever else your form may require.
3. Add Our JS Link
<script src="https://kwes.io/v2/kwes-script.js" charset="utf-8"></script>
4. Add the kwes-form class
Add the class
kwes-form to your
<form> tag. This helps our script find your form.
<form class="kwes-form"> ... </form>
5. Add our action URL
Add the form endpoint URL we provide to your form action.
<form class="kwes-form" action="YOUR_CUSTOM_FORM_ACTION"> ... </form>
6. Add your form fields
Add your form fields the same way you normally would with HTML and CSS. All fields require a unique "name" attribute.
<form class="kwes-form" action="YOUR_CUSTOM_FORM_ACTION"> <label for="name">Your Name</label> <input type="text" name="name"> <button type="submit">Submit</button> </form>
7. Add our validation rules (optional)
You can add our powerful form validation rules to your form fields inside a
rules attribute. Even though it's not required for your form to work, it's highly recommended for a better user experience and spam protection.
<form class="kwes-form" action="YOUR_CUSTOM_FORM_ACTION"> <label for="name">Your Name</label> <input type="text" name="name" rules="required|max:255"> <button type="submit">Submit</button> </form>
8. Send your first submission
Go to your form and send your first submission to connect your form to Kwes.
9. Assign domain
Every website is allowed one live domain and one testing domain for their forms. Once your first submission is completed, you will be presented with the option to assign your domain as a live or testing domain.
Step 3 of the setup process doesn't work with SPA's. If you add our JS script before the closing
</body> tag, it won't reload the script whenever you navigate away from the page and back to it.
To integrate KwesForms with your SPA you need to include the script in the mounted function of the component that you would like to use KwesForms in. This way, the script loads whenever the component loads.
const kwesScript = document.createElement('script');
Steps 3 - 7 of the setup process should be adjusted to one of these 3 options:
You can setup a Kwes form inside the WordPress page/post editor for very basic forms. With this option you run the risk of the form not working correctly since WordPress may strip the form of important components needed for it to work properly.
You can place your Kwes form code inside a template file.
You can turn your Kwes form code into a WordPress shortcode and add it to in the Wordpress page/post editor.
Notice anything wrong in our docs? Let us know.