Can not send form. Every time I get a “Error validating the Captcha” message after sumitting.
What does your form look like? Did you follow the ReCaptcha example documentation. Also did you set your ReCapatcha information in the form plugin configuration or dynamically in the form itself? Perhaps you can paste or gitst a copy of your page with the form?
Im sure have follow instructions in example documentation.
here you can see the live site with my form. form ist on home page.
hier is the page frontmatter content:
title: 'Achtsamkeit MBSR - Helga Hummel - Dipl. Psychologin'
process:
markdown: true
twig: true
cache_enable: false
recaptchacontact:
enabled: false
form:
name: contact
fields:
-
name: name
label: 'Vor- und Nachname'
placeholder: 'Geben Sie hier Ihren Namen ein.'
autofocus: 'off'
autocomplete: 'on'
type: text
validate:
required: true
-
name: telefonnummer
label: Telefonnummer
placeholder: 'Wie kann ich Sie telefonisch erreichen?'
autocomplete: 'on'
type: text
validate:
required: true
-
name: email
label: E-Mail
placeholder: 'Geben Sie hier Ihren E-Mail-Adresse ein ein'
type: email
validate:
required: true
-
name: message
label: Nachricht/Frage
placeholder: 'Ihr Nachricht oder Frage an mich'
type: textarea
validate:
required: false
-
name: erstkontakt
label: Erstkontakt
placeholder: 'Wie haben Sie von mir erfahren?'
type: textarea
validate:
required: flase
-
name: g-recaptcha-response
label: Captcha
type: captcha
recaptcha_site_key: 6Lcf1hQUAAxxxxxxxxxxxxxxznn2ucLoFOt
recaptcha_not_validated: 'Captcha not valid!'
validate:
required: true
buttons:
-
type: submit
value: Absenden
-
type: reset
value: Reset
process:
-
captcha:
recaptcha_secret: 6Lcf1hQUAxxxxxxxxxxxxxxxxxxxxxxxxxyXKmUHF
-
email:
subject: '[Site Contact Form] {{ form.value.name|e }}'
body: '{% include ''forms/data.html.twig'' %}'
-
save:
fileprefix: contact-
dateformat: Ymd-His-u
extension: txt
body: '{% include ''forms/data.txt.twig'' %}'
-
message: 'Vielen Dank fuer Ihre Nachricht.'
-
display: thankyou
here you can see the result form http://www.achtsamkeit-schwerin.de/
Use the helium skeleton.
Btw: without recaptcha the form work fine.
I pasted your recaptcha field and action, added my keys, and the form worked fine for me. Make sure the keys are enabled on the domain you use.
I have already set up many Captcha forms under Joomla. There were never any problems. It is frustrating. The page is ready, only the form with Captcha does not go.
That error comes from https://github.com/getgrav/grav-plugin-form/blob/develop/form.php#L311 - if you know a little PHP, you can do a var_dump($response)
in there, and that will print the full error (will add some error logging there)
var_dump result after $response = json_decode(file_get_contents($url), true);
{ [“success”]=> bool(false) [“error-codes”]=> array(1) { [0]=> string(22) “missing-input-response” } }
here the recaptcha sourcecode in html output:
dump from $recaptchaSecret and $params[“recaptcha_secret”]
string(40) “6Lcf1hQUAAAAAHvwEiCE7rVa4xxHwSl8ayXKmUHF” } int(1)
I have now deleted this recaptcha record for this domain at google-recaptcha tool site and created a new one. The problem also occurs with this new data.
(please post code within triple backticks or triple dashes, it’s not readable if not)
The missing-input-response
means the response
parameter is not sent. What’s the dump of $query
, in the same funciton? The $query['response']
value should be filled, as I see it defined in the form.
Also try usingname: "g-recaptcha-response"
in captcha the form field.
value of $query after submitting is:
secret=6LfB-BQUAAAxxxxxxxxxxxxxxxxxxxxxxxxxj-d0kAg9&response=03AHJ_Vuv aF2yXy3POYccPsHEDFf2ymibItoVqThYpscgv5jMSJCDobT5UeXUGpxhQU3nEuINW9ctswyARrBes7GmwTDrkubCNowLarzhOq_nRQn07HZhK4uVTrnHLx_ZFo2DW2BJgAPm5v7OfKs4D-tAP6YWZf8Kb83kYKcQHd6dzmlIgYlISodKppsGFJGRb_YbdMPri31iZA24IMB5JwZtbVDgmkRuvzbDX8etCnu3obj6pcKLikRPQ_j_qqlnkNXJWWYuNNXSIKhiunsG2r5rWGEzob26NY8cqxN8NGI8vCOYVvbpuPIIHdAnxVlcISmq7tz9fApH4a13VsjC4LfN1nEUcTN290686CviIPoWY5_5HPxtE-IqSWU2cXYkOJ1zNvZpU8nUblwH9ij_NNOzqvffKdJK5HUV2OszH3tRkp8GkYg6bqw6EseUw3AulWMhQrrgYkPGBceR5uM5PzPh-5MpoJaFKEg
Ok so the response
parameter is there. Then, I don’t understand what the problem is.
Can you show me a sample site where the recaptcha worked fine? this sora sample form has not a captcha.
Is there any step i forgotten?
Yesterday I have installed a virgin grav project in my xampp enviroment using default antimatter template. And I create a new simple form in my-project/contactform. Every time the same error message.
Sorry flavio, but I have visited a lot of pages from this reference list forum:sample-grav-sites. NO captcha is used on any form! Never ever. I’m sure that the GRAV form captcha element does not just work for me! There must be an bug.
This is not a general problem. I have just tried setting up a brand new form on a remote site I have, and it works fine.
Test form:
title: Contact
published: true
cache_enable: false
cache:
enabled: false
form:
name: contact-form
fields:
-
name: email
label: Email
id: email
type: email
validate:
required: true
-
name: g-recaptcha-response
label: Captcha
type: captcha
recaptcha_site_key: 6Lxxxxxxxxxxxr8hv
recaptcha_not_validated: 'Captcha not valid!'
validate:
required: true
buttons:
-
type: submit
value: Submit
process:
-
captcha:
recaptcha_secret: 6LxxxxxxxxxxxxlI54
-
display: thankyou
---
The fact that no site you’ve seen has a captcha form, does not mean it’s because it does not work, that would have been reported before.
Still no clear idea what could be the cause of the problem.
That’s true, of course. It just surprised me. But I am helpless and end up with my possibilities.
Should I give you an access? Or pack and send the user directory?
Can I see your remote with captcha site? I would compare the behaviors of both.
Captcha is used on my sample site: http://www.tessa.es and works perfectly. I imagine that you dispose of a private and public key for your site, this is necessary to make captcha work. It’s a google (Alphabet) service that you consume. The captcha implementation for forms in GRAV is nothing but an encapsulation for this remote service.
Validation will fail without a proper configuration in the forms plugin. There you will find two settings that allow you to supply the private and public key. You can also specify these keys into the form configuration itself.