- Posts: 56
- Thank you received: 0
Recaptcha - focus input#recaptcha_response_field
- chris
- Topic Author
- Offline
- Senior Member
-
Less
More
10 years 10 months ago #48724
by chris
Recaptcha - focus input#recaptcha_response_field was created by chris
Hi -
I was wondering if anywhere in the code I can make the Recaptcha input field become focused when the submission results in an error. Currently the page refreshes and it displays the JTEXT error message at the top. But the user needs to scroll down to field. Is this change because there appears to be no client side validation on the Recaptcha?
On the older captcha in the last version I was able to use this code in the html/com_eventbooking/register/default.php over ride:
I would like to use something similar I just cant seem to find where I can detect an error anymore. any help would be great! Using the latest version of Event Booking 1.6.5 and Joomla 2.5.19
Thanks!
I was wondering if anywhere in the code I can make the Recaptcha input field become focused when the submission results in an error. Currently the page refreshes and it displays the JTEXT error message at the top. But the user needs to scroll down to field. Is this change because there appears to be no client side validation on the Recaptcha?
On the older captcha in the last version I was able to use this code in the html/com_eventbooking/register/default.php over ride:
Code:
<?php
if ($this->captchaInvalid) {
?>
<span class="error"><?php echo JText::_('EB_INVALID_CAPTCHA_ENTERED'); ?></span>
<script>
jQuery( document ).ready(function() {
jQuery('input[name="security_code"]').focus();
});
</script>
<?php
}
?>
Thanks!
Please Log in or Create an account to join the conversation.
- Tuan Pham Ngoc
- Offline
- Administrator
-
10 years 10 months ago #48739
by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Recaptcha - focus input#recaptcha_response_field
Hi
I think you can try this code :
Please try it and let me know the result.
Regards,
Tuan
I think you can try this code :
Code:
$input = JFactory::getApplication()->input;
$captchaInvalid = $input->getInt('captcha_invalid', 1);
if ($captchaInvalid)
{
//Write the same above code.
}
Please try it and let me know the result.
Regards,
Tuan
Please Log in or Create an account to join the conversation.
Moderators: Tuan Pham Ngoc
Support
Documentation
Information
Copyright © 2025 Joomla Extensions by Joomdonation. All Rights Reserved.
joomdonation.com is not affiliated with or endorsed by the Joomla! Project or Open Source Matters.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.