Recaptcha - focus input#recaptcha_response_field

  • chris
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
10 years 10 months ago #48724 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:
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 } ?>
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!

Please Log in or Create an account to join the conversation.

More
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 :
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