Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
236 views
in Technique[技术] by (71.8m points)

forms - FormMail and reCaptcha v3

I am using the Frommail cgi (my hoster offers this and I would like to continue to use it) and I want to integrate reCaptcha v3 into it but a) do not understand really how it works and b) tried to merge Google's manual (https://developers.google.com/recaptcha/docs/v3?hl=en) with my working Formmail form but failed.

Basically the form does not send anymore - nothing happens when I click on send. Is somebody able to help me here? My script reference in section:

<script src="https://www.google.com/recaptcha/api.js"></script>
<script>
   function onSubmit(token) {
     document.getElementById("kontakt").submit();
   }
 </script>

and this is the html of my form:

<form id="kontakt" action="/cgi-sys/FormMail.cgi" method="post">
    <label class="input-label" for="first_name" >Vor- und Nachname*:</label>
    <br>
    <input class="input-field" type="text" id="name" name="Name" placeholder="Vor- und Nachname" required>
    <br>
    <label class="input-label" for="email">E-Mail*:</label>
    <br>
    <input class="input-field" type="email" id="email" name="email"  placeholder="E-Mail" required>
    <br>
    <label class="input-label" for="tel">Telefon:</label>
    <br>
    <input class="input-field" type="tel" id="tel" name="tel"  placeholder="Telefonnummer">
    <br>
    <label class="input-label" for="comment">Kommentar oder Nachricht*:</label>
    <br>
    <textarea class="input-field input-comment" id="comment" name="comment" cols="100" style="display:block" required></textarea>
    <br>    
    <input class="g-recaptcha form-button" data-sitekey="mysitekey"  data-callback="onSubmit" data-action="submit" type="submit" name="submit" value="Formular abschicken" />
    <input type="hidden" name="recipient" value="info@bike-activities.ch"/>
    <input type="hidden" name="subject" value="Kontaktformular"/>
    <input type="hidden" name="redirect" value="https://www.bike-activities.ch/pages/form-success.html"/>
    <input type="hidden" name="print_config" value="submit, recipient, redirect, subject"/>
</form>

The captcha shows up on the lower right corner.

Any help is appreciated

Roger

question from:https://stackoverflow.com/questions/65643458/formmail-and-recaptcha-v3

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...