appleboy / appleboy/react-recaptcha

How do I get the response from Inside my class

Open
#22 2 comments 3 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
643
Forks
96
PR merge metrics
No merged PRs in 30d

Description

Basically I'm trying to validate the response from inside my _onSubmit() function is this possible I've tried moving the callback function inside the class so i could use setState or something but Recaptcha fails to locate the function if i put it inside the class.

I'm thinking maybe the better idea is to probably is to check the validation server side right? I'm probably implementing recaptcha wrong trying to handle everything client side?

```
class ContactForm extends React.Component{
constructor(){
super();
this._onSubmit = this._onSubmit.bind(this);
}

_onSubmit(e){
//I WANT TO VALIDATE THE RESPONSE HERE
}

render(){
return(

Submit

);
}
}

let captchaReturn = function(response){
if(response.length === 0){
alert("no");
}
else {
document.getElementById("myBtn").disabled = false;
}
}

let onloadCallback = function() {

}

```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.