The Form Tools forums are no longer active, but the old posts have been archived here. Please see the Help page on how to get help / report issues.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Recaptcha error message placement
How can I place the recaptcha error message at the top of the form (in the same place as the validation error messages appear) rather than within the recaptcha box? I think the user will miss that and be confused. Any ideas?
Yeah... I agree. Let me look at this and I'll get back to you later today.

- Ben

I looked through the code and you can fluff to make the error message appear wherever you want. Here's how the code works.

The ft_api_process_form() function does all the heavy lifting for API forms. It handles updating the form submission values, redirecting to the next page, and handling incorrectly entered reCAPTCHAs.

If the reCAPTCHA is entered incorrectly, it sets a $g_api_recaptcha_error global variable and stays on the same page. The ft_api_display_captcha() function checks to see if that variable is set then output the error.

So what you can do is catch that variable earlier in the page, e.g. the top, and just output it there. For example:

PHP Code:
<?php if (!empty($g_api_recaptcha_error)) { ?>
  <div>Error message here! (<?=$g_api_recaptcha_error?>)</div>
<?php ?>

If you don't want that error message to appear by the reCAPTCHA as well, just empty the variable value as well:

PHP Code:
<?php if (!empty($g_api_recaptcha_error)) { ?>
  <div>Error message here! (<?=$g_api_recaptcha_error?>)</div>
  <?php $g_api_recaptcha_error ""?>

Sorry it's a bit of a hack, but it's not TOO bad...!

- Ben
Whenever you try to enter in the different forums then you have to follow the numerous instructions. Although, it is said that reviews are helping all the users to make them aware.

Forum Jump:

Users browsing this thread: 1 Guest(s)