Captcha Usage
FormLister can use modified Evo captcha and Google reCAPTCHA by default.
Set the "captcha" parameter value with the name of captcha files folder (located at assets/snippets/FormLister/lib/captcha/) to enable it:
&captcha=`modxCaptcha`
The parameter named "captchaParams" contains an array of captcha settings. For example:
&captchaParams=`{ "width":200, "height":120 }`
The field name to get captcha value from user is defined by the "captchaField" parameter ("vericode" by default). Validation rule for this field is created automatically.
To output captcha in form template use [+captcha+] placeholder.
modxCaptcha
Parameters:
Property | Description |
---|---|
width and height | width and height of a captcha image (100 and 60 by default); |
inline | output format. If it's 1, then [+captcha+] placeholder contains an image in base64-format. If it's 0, then placeholder contains the link to connector.php file, which generates captcha image. Default value - 1; |
connectorDir | path to the folder containing connector.php file, if "inline" parameter is set to 0. Default value - assets/snippets/FormLister/lib/captcha/modxCaptcha/; |
errorEmptyCode | error message, if user doesn't enter captcha. |
errorCodeFailed | error message, if user enters wrong value. |
reCAPTCHA
Uses Google reCAPTCHA V2.
To be able to use Googles' reCAPTCHA you must include the following script in the page where you wish to display it:
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
The value of the "captchaField" parameter must be set to "g-recaptcha-response" (view the official documentation).
Parameters:
Property | Description |
---|---|
secretKey, siteKey | keys to access reCAPTCHA api; |
size, theme, badge, callback, expired_callback, tabIndex, type | view the official documentation; |
errorCodeFailed | error message if captcha validation failed. |
Example:
&captchaParams=`{ "siteKey":"", "secretKey":"", "errorCodeFailed":"", "theme":"light" }`
Suggest an edit to this page.