Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
LICENSE
README.md

README.md

Recaptcha

Recaptcha for Nette Framework 2.4+

Usage

NEON configuration

parameters:
    recaptcha:
        sitekey: ...
        secret: ...

Example

Add extension method:

/**
 * @param \Nette\Forms\Container
 * @param string
 * @param string
 * @param string
 * @return \App\UI\Forms\Controls\Recaptcha
 */
Container::extensionMethod('addRecaptcha', function (Container $form, $name = 'recaptcha', $caption = 'Recaptcha', $message = 'Recaptcha validation failed.') {
    return $form[$name] = new App\UI\Forms\Controls\Recaptcha($caption, $message);
});

Add input in form

$form = new Form($this, $name); // form must be attached to presenter
$form->addRecaptcha();

Latte template

{input recaptcha}

HTML

...
<script src="https://www.google.com/recaptcha/api.js"></script>
</body>
</html>
You can’t perform that action at this time.