79350983

Date: 2025-01-13 01:07:55
Score: 0.5
Natty:
Report link

It looks like you want to trigger the reCAPTCHA when clicking "Book Now" and only submit the form if reCAPTCHA passes. From your code, I see you have the correct setup for reCAPTCHA, but you might be missing the crucial part of form submission.

Here's a quick fix:

  1. Remove type="button" from the "Book Now" button.
  2. Update the onSubmit function to ensure that it submits the form only after reCAPTCHA validation.

Here's how you can modify the JavaScript:

<script>
   function onSubmit(token) {
     document.getElementById("first-form").submit();  // Submit the form after validation
   }
</script>

The button should trigger the onSubmit callback when clicked:

<button 
    class="g-recaptcha btn btn-primary" 
    data-sitekey="your-site-key" 
    data-callback="onSubmit" 
    data-action="submit">
    Book Now
</button>

Make sure you also verify the reCAPTCHA response on the server-side (PHP) by sending the token to Google for validation. Let me know if that clears things up!

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: user29169858