Reputation: 1
When I try to place the recaptcha container outside the required modal (for testing), the grecaptcha.getResponse() is returning a valid string. But, when I move that container to the modal again (where it should be), grecaptcha.getResponse() is always returning blank string. Kindly help. This is the modal code below.
<div id="addReviewPopup" class="modal">
<div class="modal-content">
<span class="close-btn" onclick="closePopup('addReviewPopup')">×</span>
<h2>Add Review</h2>
<form id="addReviewForm" method="post">
<p id="businessDetails">Business details will appear here.</p>
<label for="reviewText">Your Review:</label>
<textarea id="reviewText" placeholder="Write your review here..." required></textarea><br>
<label for="starRating">Star Rating:</label>
<select id="starRating" required>
<option value="">Select</option>
<option value="1">⭐</option>
<option value="2">⭐⭐</option>
<option value="3">⭐⭐⭐</option>
<option value="4">⭐⭐⭐⭐</option>
<option value="5">⭐⭐⭐⭐⭐</option>
</select><br>
<div class="g-recaptcha" data-sitekey="6LeVWpAqAAAAAIoVEEJNTY4S5L4larqFsRLpjX16"></div>
<button type="submit" id="submitReviewBtn">Submit Review</button>
</form>
</div>
</div>
Kindly help since I am a beginner and not at all being able to figure it out. Thanks.
I tried testing it by moving the captcha container outside the modal, into the main body, it is working there. But, when I again move it into the modal, it is returning me a blank string.
Upvotes: 0
Views: 47