views:

502

answers:

0

Hi all,

I'm using reCAPTCHA via its AJAX API to display the captcha in a modal dialog box. I'm using jqModal to display the boxes, and I'm using the AJAX version of reCAPTCHA because the PHP version is already buggy with jqModal (a known bug: http://markmail.org/message/bvip5vyb3czm7ngu).

Now, the reCAPTCHA works fine in Firefox. But in Safari, it doesn't always get displayed. Sometimes, it works fine, but about 20% of the time, no reCAPTCHA box is displayed.

The jqModal declaration looks like this:

$().ready(function() {
  $('#modalBox_register').jqm({
  ajax: '/modals/register.php',
  trigger: 'a#registerButtonLink',
  onShow: function(h) {
   h.w.css('opacity', 1.00).fadeIn(300);
   },
  onHide: function(h) {
   h.w.fadeOut(300, function() { if (h.o) h.o.remove(); });
   }
 });
});

And the HTML/PHP within the modal box looks like this:

<div id="registerModal">
 <p class="caption">Registration form:</p>
 <form name="registerForm" id="modalRegisterForm" class="modalForm" action="/register/" method="post">

   <table cellspacing="15" border="0">
    <tr>
     <td class="left"><label for="firstName">First Name:</label></td>
     <td class="right"><input type="text" name="firstName" id="firstName" value="" class="registerModalTextField" /></td>
    </tr>
    <tr>
     <td class="left"><label for="lastName">Last Name:</label></td>
     <td class="right"><input type="text" name="lastName" id="lastName" value="" class="registerModalTextField" /></td>
    </tr>
    <tr>
     <td class="left"><label for="email">Email Address:</label></td>
     <td class="right"><input type="text" name="email" id="email" value="" class="registerModalTextField" /></td>
    </tr>
    <tr>
     <td class="left"><label for="password">Password:</label></td>
     <td class="right"><input type="password" name="password" id="password" value="" class="registerModalTextField" /></td>
    </tr>
    <tr>
     <td class="left"><label for="passwordConfirm">Confirm Your Password:</label></td>
     <td class="right"><input type="password" name="passwordConfirm" id="passwordConfirm" value="" class="registerModalTextField" /></td>
    </tr>

    <tr>
     <td class="left">&nbsp;</td>
     <td class="right"><div id="termswrap">
      <input id="terms" type="checkbox" name="terms" />
               <label id="lterms" for="terms">&nbsp;I have read and accept the <a href="/backmatter/termsofuse/">Terms of Use.</a><br /></label>
              </div><!-- /#termswrap --></td>
    </tr>


    <!-- reCAPTCHA -->
    <tr>
     <td class="left"><label for="captcha">Are you human?</label></td>
     <td class="right"><!-- Using the reCAPTCHA AJAX API, because the non-AJAX API is buggy with jqModal -->
     <div id="recaptcha_div"></div>
     <script type="text/javascript"
      src="http://api.recaptcha.net/js/recaptcha_ajax.js"&gt;&lt;/script&gt; <script
      type="text/javascript">
          Recaptcha.create("123456789...",
           "recaptcha_div", {
             theme: "white"
          });
         </script>

     </td>
    </tr>


    <tr>
     <td class="left">&nbsp;</td>
     <td class="right"><input type="image" id="submitButton" src="/images/modals/button_register.png" value="Submit" alt="Submit" name="submit" /></td>
    </tr>
   </table>


 </form>
</div><!--/#registerModal-->

Does anybody have a clue why the reCAPTCHA AJAX call isn't working properly in Safari?