I want to use Google ReCaptcha but i also dont't want to touch server side or back-end code.
I am using ASP.Net MVC but i also don't want to use any package from nuget or any library. Solution must be front-end only. All javascript/jquery solutions are accepted.
I also note that my forms are collecting data and sending it as an e-mail to specified mailbox. I am also not using any 3rd party library for this process. It is manually coded only by ASP.Net MVC.
Thanks to Ivo Coumans for detailed explanation. I got it working but obvously it is not safe. Rinto Antony gave me an idea here is what i do.
I am calling the Google ReCaptcha API to head section of my website and adding the div that creates the captcha:
<div class="g-recaptcha" data-sitekey="api_key" data-callback="enableBtn"></div>
Since data-callback is triggering enableBtn function, it is possible to take action if it is returning true. So i have added a disabled submit button to my form.
<input type="submit" value="Gönder" id="button1" disabled>
Then i have added a simple javascript to enable it:
<script type="text/javascript">
function enableBtn() {
document.getElementById("button1").disabled = false;
}
</script>
I am aware that this can be easily bypassed and not a real solution but it is working. I am open to any ideas that can make this better.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With