{"id":297,"date":"2022-04-30T01:29:15","date_gmt":"2022-04-29T19:59:15","guid":{"rendered":"https:\/\/formx.stream\/blog\/?p=297"},"modified":"2023-04-07T17:57:00","modified_gmt":"2023-04-07T12:27:00","slug":"how-to-quickly-add-contact-form-to-your-static-website","status":"publish","type":"post","link":"https:\/\/formx.stream\/blog\/how-to-quickly-add-contact-form-to-your-static-website\/","title":{"rendered":"How To Quickly Add Contact Form To Your Static Website"},"content":{"rendered":"<h2><b>Why adding a contact form to a static website can be tricky<\/b><\/h2>\n<p><span style=\"font-weight: 400;\">One of the biggest complaints about static websites is that they don&#8217;t allow you to easily collect user data\u2014like when a visitor wants to sign up for your newsletter, or email you a question. Traditional dynamic websites have forms designed to gather this kind of information and send it to the site owner. With static sites, though, there&#8217;s no way for the information to be collected without setting up servers and databases, which can be expensive and time-consuming. Before we get into adding forms on a static site, I should say that not everything is wrong with this type of website. In fact, they are fast, secure and are great for SEO. Here&#8217;s an article on <a href=\"https:\/\/formx.stream\/blog\/static-website-benefits\/\">static website benefits.<\/a><\/span><\/p>\n<h2><b>Ways of adding a form to a static website<\/b><\/h2>\n<p><span style=\"font-weight: 400;\">One way is to use a dedicated form builder like Typeform, Wufoo, or Google Forms. These services let you create forms and embed them in your site. You can even add custom CSS to make sure they match the rest of your design.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">But what if you want full control over how your form works? In that case, you can try building it out yourself and using a form-backend provider like <\/span><a href=\"https:\/\/formx.stream\/features.html\"><span style=\"font-weight: 400;\">formX<\/span><\/a><span style=\"font-weight: 400;\">. That way, you can design your forms however you want to (without struggling with the templates full-fledged form builders provide), and leave the backend to us.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">There are many such providers out there, here is a wonderful <a href=\"https:\/\/css-tricks.com\/a-comparison-of-static-form-providers\/\">article<\/a> breaking down and comparing all of their features<\/span><span style=\"font-weight: 400;\">. Thanks to the author for featuring formX in the list.\u00a0<\/span><\/p>\n<h2><b>A step-by-step guide on how to add a contact form to your static website<\/b><\/h2>\n<p><span style=\"font-weight: 400;\">First, create a free account with formX <a href=\"https:\/\/app.formx.stream\/app\/register\">here<\/a><\/span><span style=\"font-weight: 400;\">. Set up the basic details, if you need help, our <\/span><a href=\"https:\/\/docs.formx.stream\/\"><span style=\"font-weight: 400;\">docs<\/span><\/a><span style=\"font-weight: 400;\"> have everything you would want to know.\u00a0<\/span><\/p>\n<h3><strong>Step 1: Create your HTML form<\/strong><\/h3>\n<p><span style=\"font-weight: 400;\">Here is a short form to get you started:<\/span><\/p>\n<blockquote><p><span style=\"font-weight: 400;\">&lt;form id=&#8221;form_id&#8221;&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">&lt;input name=&#8221;name&#8221; type=&#8221;text&#8221; \/&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">&lt;input name=&#8221;email&#8221; type=&#8221;email&#8221; \/&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">&lt;input type=&#8221;submit&#8221; id=&#8221;submit&#8221; \/&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">&lt;\/form&gt;<\/span><\/p><\/blockquote>\n<p><span style=\"font-weight: 400;\">Note that, HTML element &#8220;id&#8221; is the only mandatory attribute required in the form tag. Attributes like &#8220;action&#8221; and &#8220;method&#8221; are not needed. Now go ahead and design your form\u2019s front-end.<\/span><\/p>\n<h3><strong>Step 2: Add the formX snippet to the specific form page in your website<\/strong><\/h3>\n<p><span style=\"font-weight: 400;\">Insert the following script to the page before the end of the body tag.<\/span><\/p>\n<blockquote><p><span style=\"font-weight: 400;\">&lt;script src=&#8221;https:\/\/static.formx.stream\/tracker\/v1\/bundle.js&#8221;&gt;&lt;\/script&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">&lt;script&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">var formx = FormX.set()<\/span><\/p>\n<p><span style=\"font-weight: 400;\">formx.trackProject(&#8216;Cyces_2653407d-8549-4a6d-8038-952725ca66a0&#8217;)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">formx.trackForm(&#8216;Test_314c85bd-e690-4fa5-b58b-047525d9299b&#8217;, &#8216;form_id&#8217;)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">formx.start()<\/span><\/p>\n<p><span style=\"font-weight: 400;\">&lt;\/script&gt;<\/span><\/p><\/blockquote>\n<h3><strong>Step 3: Test your forms<\/strong><\/h3>\n<p><span style=\"font-weight: 400;\">Now formX is powering your forms\u2019 backend. Submit test data to check if everything works fine. You might run into the following errors:\u00a0<\/span><\/p>\n<ul>\n<li><span style=\"font-weight: 400;\">Invalid domain: The configured domain and the actual domain are different<\/span><\/li>\n<li><span style=\"font-weight: 400;\">Form not found: No form with the form ID has been foundNo form with the given form id found<\/span><\/li>\n<li><span style=\"font-weight: 400;\">Field error: No &#8220;name&#8221; has been set to the field<br \/>\n<\/span><\/li>\n<\/ul>\n<p>Now, you&#8217;re good to go!<\/p>\n<p><strong>Read more:<\/strong><\/p>\n<p>The only guide you&#8217;ll need for to nail your <a href=\"https:\/\/formx.stream\/blog\/cta-placemement-best-practices\/\">cta placement<\/a><\/p>\n<p>What are <a href=\"https:\/\/formx.stream\/blog\/what-are-form-endpoints\/\">form endpoints<\/a><\/p>\n<p>Get more from our forms with our <a href=\"https:\/\/formx.stream\/blog\/web-form-optimization\/\">web form optimization tips<\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Why adding a contact form to a static website can be tricky One of the biggest complaints about static websites is that they don&#8217;t allow you to easily collect user data\u2014like when a visitor wants to sign up for your newsletter, or email you a question. Traditional dynamic websites have forms designed to gather this [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-297","post","type-post","status-publish","format-standard","hentry","category-general"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/formx.stream\/blog\/wp-json\/wp\/v2\/posts\/297","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/formx.stream\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/formx.stream\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/formx.stream\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/formx.stream\/blog\/wp-json\/wp\/v2\/comments?post=297"}],"version-history":[{"count":6,"href":"https:\/\/formx.stream\/blog\/wp-json\/wp\/v2\/posts\/297\/revisions"}],"predecessor-version":[{"id":360,"href":"https:\/\/formx.stream\/blog\/wp-json\/wp\/v2\/posts\/297\/revisions\/360"}],"wp:attachment":[{"href":"https:\/\/formx.stream\/blog\/wp-json\/wp\/v2\/media?parent=297"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/formx.stream\/blog\/wp-json\/wp\/v2\/categories?post=297"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/formx.stream\/blog\/wp-json\/wp\/v2\/tags?post=297"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}