How to submit forms to Notion using Javascript

If you want to keep your visitor on the same page when they submit your form, then using Javascript is your best best. With Notion Monkey, you can easily submit data from your webpage to Notion, using Javascript. No backend coding required.

Once you create a form in the Notion Monkey dashboard, Notion Monkey will provide a form url or "form action" where you can start posting data. This unique action is all you need to post data into the Notion DB.

Then you just need to use the Notion Monkey action with your Javascript HTTP query as in the following example:

<h2>Contact Form</h2> <form id="myForm"> <div> <label for="name">Name:</label> <input type="text" id="name" name="name" required> </div> <div> <label for="email">Email:</label> <input type="email" id="email" name="email" required> </div> <div> <label for="message">Message:</label> <textarea id="message" name="message" required></textarea> </div> <button type="submit">Submit</button> </form> <script type="text/javascript"> document.getElementById('myForm').addEventListener('submit', async function(event) { event.preventDefault(); const formData = new FormData(this); const url = ''; try { const response = await fetch(url, { method: 'POST', body: formData }); if (response.ok) { console.log('Form submitted successfully!'); // Reset form fields if needed this.reset(); } else { console.error('Form submission failed:', response.status); } } catch (error) { console.error('Network error:', error); } }); </script>

Once you submit this form, the data will appear in the linked db like this:

Hey, that was pretty easy!

Notion Monkey is free to get started. Why not create an account and connect it with a Javascript form? See for yourself how simple it is to start saving your form data in Notion.

Get Started for Free
Get started