1

I am using two forms on a single page on a client's WordPress site. A while back I implemented reCAPTCHAs for each form. If I remember correctly you weren't able to use two on a single page so after doing some research I found that it could be done by cloning the first one with javascript.

<div id='ppc-recap'>
...(reCAPTCHA HTML removed for brevity)...
</div>

<div id='ppc-recap2'></div>

jQuery('#ppc-recap2').html(jQuery('#ppc-recap').clone(true,true));

This worked back then however now it is not. I get the following warning in the browser console:

Failed to execute 'write' on 'Document': It isn't possible to write into a document from an asynchronously-loaded external script unless it is explicitly opened.

There are two of these warnings. Each appears to caused by the clones of the two scripts reCAPTCHA uses. I'm lost here, guys.

Salman A
  • 262,204
  • 82
  • 430
  • 521
tacudtap
  • 120
  • 1
  • 2
  • 12
  • I draw captcha inside the form which has focus. Will that work? – Salman A Nov 03 '14 at 21:07
  • Hmmm... that might work. How would I determine which form they are filling out? – tacudtap Nov 03 '14 at 21:10
  • I trap the focus event; in fact, I display when they start filling in the form. You can change it to mouseover/out. Not sure about usability though. – Salman A Nov 03 '14 at 21:12
  • But what if they started filling out one then realized they should be filling out the other? – tacudtap Nov 03 '14 at 21:17
  • The captcha moves below the other one automatically. There will still be one captcha (the documentation suggests only one can be displayed). – Salman A Nov 03 '14 at 21:20
  • Oh! I get it. Let me give that a try. Do you want to put that as an answer so I can mark it accepted once it works for me? – tacudtap Nov 03 '14 at 21:24
  • possible duplicate of [How do I show multiple recaptchas on a single page?](http://stackoverflow.com/questions/1241947/how-do-i-show-multiple-recaptchas-on-a-single-page) – Huseyin Yagli Jan 24 '15 at 15:25

0 Answers0