Spam Protection

In case you have a problem with a spammer, you can integrate Google reCAPTCHA to your form for protection.

To protect you from spam bot we provide feature to integrate your form with Google reCAPTCHA. As for now Formcubes support Google reCAPTCHA checkbox that will make spam bot harder to slip into your inbox. Here is how to integrate Google reCAPTCHA to your form:

Step 1 - Enable Google ReCaptcha on your form setting

First thing first, you need enable Google reCAPTCHA on your form setting. To do that you need to sign in to Formcubes Admin Panel > open your form setting > open "Form name and spam protection" > Check "Enable Google reCAPTCHA for spam protection" > Save configuration.

Step 2 - Add Google reCAPTCHA to your HTML form

Step 2.1 - Add script tag to your page

You must add the following script tag before the closing head tag.

<script src="https://www.google.com/recaptcha/api.js" async defer></script>

Step 2.2 - Add Google reCAPTCHA checkbox to your form

Add the following element inside your form element. Please do not change the sitekey otherwise reCAPTCHA will not work.

<div class="g-recaptcha" data-sitekey="6Lfvj8EUAAAAAOWJGlV090uDY5-xs21ZZJc0F3Ie"></div>

That's all you need to do to integrate reCAPTCHA into your form. Your forms now should be secured from spam bot.

Code Example

Here is an example of forms with Google reCAPTCHA, we added a little JavaScript validation to make sure user checked the reCAPTCHA checkbox before submitting a form.

<html>
<head>
<title>reCAPTCHA demo: Contact Form</title>
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
</head>
<body style="margin: 20px;">
<!-- Contact form element -->
<form action="https://api.formcubes.com/reg/v1/s/{your-form-id}" method="POST" onsubmit="return validateReCaptcha()">
<label>Name :</label><br>
<input type="text" name="name"><br><br>
<label>Email :</label><br>
<input type="email" name="email"><br><br>
<label>Message :</label><br>
<textarea rows="5" type="text" name="message"></textarea><br><br>
<!-- put reCAPTCHA inside form element -->
<div class="g-recaptcha" data-sitekey="6Lfvj8EUAAAAAOWJGlV090uDY5-xs21ZZJc0F3Ie"></div>
<br/>
<input type="submit" value="Submit">
</form>
</body>
<script>
// function to make sure visitor checked the reCAPTCHA before submitting a form
function validateReCaptcha() {
if (grecaptcha.getResponse().length === 0) {
alert("Please make sure you're not a robot");
return false;
} else {
console.log('Validated');
return true;
}
}
</script>
</html>