Configuration
Zencaptcha Widget Configuration
You can configure Zencaptcha to set custom optional attributes on the Zencaptcha container.
Optional attribute examples
<div class="zenc-captcha" data-sitekey="<sitekey>" data-callback="<function name>" data-start="<auto|focus>" data-lang="<lang>"></div>
| Attribute | Value | Description |
|---|---|---|
| data-sitekey | <sitekey> | Your public site key. |
| data-callback | <function name> | Optional. Called when the challenge is successfully solved. The solution (token) will be passed to your callback. |
| data-lang | <two letter language code> | Optional. The widget will automatically select the best language for the user (30+ languages). However, you can override this and set the widget to a fixed single language. The full list of two-letter language codes is below. |
| data-start | auto/focus | Optional. auto: This will start solving the challenge immediately after the page load. focus: This will start solving the challenge immediately when the user clicks into an input within the <form>. The zenc-captcha div needs to be inside that <form> for focus to work. See example below. |
Two letter language codes
One of these two letter language codes can be inserted into the data-lang attribute.
| Code | Language |
|---|---|
| bg | Bulgarian |
| ca | Catalan |
| cs | Czech |
| da | Danish |
| de | German |
| el | Greek |
| en | English |
| et | Estonian |
| es | Spanish |
| fi | Finnish |
| fr | French |
| hr | Croatian |
| hu | Hungarian |
| it | Italian |
| ja | Japanese |
| lt | Lithuanian |
| lv | Latvian |
| nl | Dutch |
| no | Norwegian |
| pl | Polish |
| pt | Portuguese |
| ro | Romanian |
| ru | Russian |
| sk | Slovak |
| sl | Slovenian |
| sr | Serbian |
| sv | Swedish |
| uk | Ukrainian |
| vi | Vietnamese |
| zh | Chinese |
start with user input
The following code immediately resolves the captcha as soon as the user clicks in an input field inside <form> or inside <div class="zenc-form">. zenc-captcha must be inside it.
The user does not have to actively click on the Zencaptcha widget, resulting in a great user experience
data-start=focus -> within <form>
<form>
<label for="name">Name:</label>
<input type="text" id="name" name="name" placeholder="Enter your name">
<div class="zenc-captcha" data-start="focus" data-sitekey="<sitekey>"></div>
</form>
data-start=focus -> within <div class='zenc-form'>
<div class="zenc-form">
<label for="name">Name:</label>
<input type="text" id="name" name="name">
<div class="zenc-captcha" data-start="focus" data-sitekey="<sitekey>"></div>
</div>