Recaptcha3Token plugin

Send the Google reCAPTCHA v3 token to the back-end when the form is valid
Use the Recaptcha3 plugin if you want to verify the Google reCAPTCHA v3 token

Usage

To use it, you need to register a site and secret keys at reCaptcha admin page.
The following piece of code is the starting point to use the Recaptcha3Token plugin:
<html>
<head>
<link rel="stylesheet" href="/vendors/formvalidation/dist/css/formValidation.min.css" />
</head>
<body>
<form id="demoForm" method="POST">...</form>
<script src="https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.35.3/es6-shim.min.js"></script>
<script src="/vendors/formvalidation/dist/js/FormValidation.min.js"></script>
<script src="/vendors/formvalidation/dist/js/plugins/Recaptcha3Token.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function(e) {
FormValidation.formValidation(
document.getElementById('demoForm'),
{
fields: {
...
},
plugins: {
...,
recaptcha3Token: new FormValidation.plugins.Recaptcha3Token({
action: ...,
hiddenTokenName: ...,
language: ...,
siteKey: ...,
}),
},
}
);
});
</script>
</body>
</html>
The sample code above assumes that the FormValidation files are placed inside the vendors directory. You might need to change the path depending on where you place them on the server.

Options

(* denotes a required parameter)
OptionTypeDescription
action *StringThe page action
hiddenTokenName *StringThe name of hidden token input generated by Google reCAPTCHA v3
languageStringThe language code defined by reCAPTCHA
siteKey *StringThe site key provided by Google

Changelog

v1.7.0
  • First release. It means that the Recaptcha3Token plugin requires FormValidation v1.7.0 or newer