- This topic has 12 replies, 2 voices, and was last updated 5 years, 10 months ago by
Support. This post has been viewed 2313 times
-
AuthorPosts
-
October 19, 2020 at 12:45 am #10034799
ppericles
ParticipantHello,
I have my contact page correctly setup to work with recaptcha v2.
But I cannot make it work for v3. I put the correct v3 site and secret keys, but I get an error “error for site owner invalid key type”.Any ideas?
Thanks.
Template Version: 8.1October 20, 2020 at 12:05 am #10034802Support
KeymasterHello,
The advanced contact form (contact-us-advanced.php) is not ready for use with recaptcha v3. This case we need remove the validation of fields at front end and make it on server side (PHP).
1) First remove the
view.contact.jsscript from the page:<script src="js/views/view.contact.js"></script>
2) Change the recaptcha script on footer with this new code:
<script src="https://www.google.com/recaptcha/api.js"></script> <script> function onSubmit(token) { document.getElementById("contactFormAdvanced").submit(); } </script>3) Inside the from, change the submit button from this:
<input type="submit" value="Submit Now" class="btn btn-outline custom-btn-style-4 text-uppercase mt-1" data-loading-text="Sending...">
To this:
<input type="submit" value="Submit Now" class="btn btn-primary btn-modern pull-right g-recaptcha" data-sitekey="YOUR_V3_SITE_KEY" data-callback='onSubmit' data-action='submit' data-loading-text="Sending...">
4) Now we need make the validation of fields on server side. First change the HTML of fields to this new:
https://pastebin.com/raw/fC6XLL0bOn top of page at the PHP code, change this:
if(isset($_POST['emailSent'])) {To this:
if( isset($_POST['emailSent']) && !empty($_POST['name']) && !empty($_POST['email']) && !empty($_POST['message']) ) {Please try that and let us know if you need further assistance.
Kind Regards,
Rodrigo.
October 20, 2020 at 12:16 am #10034805ppericles
ParticipantHello,
If I remove view.contact.js then I will not be able to have file attachments.Pericles
October 20, 2020 at 12:27 am #10034806Support
KeymasterHello Pericles,
At really the
view.contact.jshave no relation with file attachments. The attachment fields works trough PHP code:

Hope this helps and clarify about the attachment field!
Kind Regards,
Rodrigo.
If you are satisfied with Porto HTML and our support, please leave your comment and rating on ThemeForest downloads page. That helps us a lot: https://themeforest.net/downloads
October 20, 2020 at 2:45 am #10034807ppericles
ParticipantHello,
Thanks. Everything is working now.
However, a small fix is required. When the page is scrolled down and the footer is displayed, the recaptcha logo on the bottom right disappears.Thanks,
Pericles
October 20, 2020 at 6:30 am #10034808Support
KeymasterHello,
Great!
You can move the recaptcha badge to front with this code below at (css/custom.css):
.grecaptcha-badge { z-index: 999999; bottom: 55px !important; top: auto !important; }* This code also moves badge a bit to top (prevent stay over scroll to top button).
We hope this helps!
Please try that and let us know if you need further assistance.
Thank you very much for your 5 star review and message at our ThemeForest item!
Kind Regards,
Rodrigo.
October 20, 2020 at 7:01 am #10034809ppericles
ParticipantHello.
Thanks. How can I have the recaptcha logo under the scroll to top button, but above the footer?Thanks,
Pericles
October 20, 2020 at 11:13 pm #10034812Support
KeymasterHello Pericles,
The custom CSS code I sent for you should do that. I entered your website and saw you paste the code a bit different, with
5pxfor thebottomvalue. Please try changing to55pxlike the code below:.grecaptcha-badge { z-index: 999999; bottom: 55px !important; top: auto !important; }Please try that and let us know if you need further assistance.
Kind Regards,
Rodrigo.
October 21, 2020 at 5:11 am #10034818ppericles
ParticipantOK, I got it.
One final question: If I have 2 forms on a single html (not php) page how do I tie them to the recaptcha?
Is the following piece of code correct?
<script src=”https://www.google.com/recaptcha/api.js”></script>
<script>
function onSubmit(token) {
document.getElementById(“formId01”).submit();
document.getElementById(“formId02”).submit();
}
</script>
Thanks,
Pericles
October 21, 2020 at 6:27 am #10034821Support
KeymasterHello Pericles,
This is the correct code:
<script src="https://www.google.com/recaptcha/api.js"></script> <script> function onSubmit(token) { document.getElementById("contactFormAdvanced").submit(); } function onSubmit2(token) { document.getElementById("contactFormAdvanced2").submit(); } </script>Inside the form you should explicit the functions above. For example:
Form 1: <input type="submit" value="Submit Now" class="btn btn-primary btn-modern pull-right g-recaptcha" data-sitekey="YOUR_V3_SITE_KEY" data-callback='onSubmit' data-action='submit' data-loading-text="Sending..."> Form 2: <input type="submit" value="Submit Now" class="btn btn-primary btn-modern pull-right g-recaptcha" data-sitekey="YOUR_V3_SITE_KEY" data-callback='onSubmit2' data-action='submit' data-loading-text="Sending...">
Hope this helps!
Please try that and let us know if you need further assistance.
Kind Regards,
Rodrigo.
October 22, 2020 at 2:07 am #10034831ppericles
ParticipantHello Rodrigo.
Thanks.
I tried to apply your suggestion on page gr-captoria%20dm.html, but it doesn’t seem to work at all.Any ideas?
Thanks.
October 22, 2020 at 5:46 am #10034833ppericles
ParticipantHello,
I managed to resolve my problem.Thanks,
Pericles
October 22, 2020 at 6:27 am #10034838Support
KeymasterHello Pericles,
Great! 🙂
If you need further assistance, feel free to contact us.
Kind Regards,
Rodrigo.
If you are satisfied with Porto HTML and our support, please leave your comment and rating on ThemeForest downloads page. That helps us a lot: https://themeforest.net/downloads
-
AuthorPosts
This topic is marked as "RESOLVED" and can not rceive new replies.