I wanted to build something that’s probably best described as a contact formular.
For spam protection I wanted to use the google reCaptcha provided by wix.
That worked exactly one time. After that all tests went wrong. If I tick the box, it gives me the green checkmark, but it doesnt trigger the “onVerified” function, because console always shows the verification variable as false. Tried everything from clearing cookies, etc., even using a second computer to be sure. It must be some issue with the code.
That’s the code, that works with the captcha:
let verification = false;
export function captcha1_verified() {
verification = true;
console.log(verification);
}
export function xyz_click() {
if(name === "" | mail === "" | contact === "" | adress === "" | capacity === "" | shoppingtype === "" | bildurl === undefined | verification === false) {
$w('#text13').text = "Bitte alle Felder ausfüllen";
$w('#text13').show();
console.log(verfication);
} else {
...
}
}
What am I missing?
Edit: I also noticed, console provides me a link, after clicking the box/solving the puzzle, something like this: https://www.google.com/recaptcha/api2/userverify?k=6LejwKAUAAAAACs5B-wV9ndjxrE49x3lGztPznl_