Add reCaptcha to webpart

giang le asked on January 19, 2015 10:33

Hi all,

I want to add a reCaptcha to my webpart(.ascx). I read the instruction however it is only added to (custom tables, document types, and forms). Can I use the Recaptcha.ascx to my webpart? Or I have to use<cms:RecaptchaControl ID="test" runat="server" PrivateKey="" PublicKey=""/> to add reCaptcha to my page?

Thank!

Recent Answers


Brenden Kehren answered on January 19, 2015 15:36

What does your webpart consist of? Is it a form or what type of actions are you performing?

The form control (/CMSFormControls/Captcha/Recaptcha.ascx) is setup to be used as a form control within Kentico. You could use the base user control as you have mentioned above (< cms:RecapthcaControl >) and get what you're looking for although you'll need to set some properties as well as register some client scripts. You can take a look at the form control code for the exact script to use.

0 votesVote for this answer Mark as a Correct answer

Hozefa Mangalorewala answered on January 19, 2015 16:14 (last edited on January 19, 2015 16:23)

0 votesVote for this answer Mark as a Correct answer

giang le answered on January 20, 2015 04:02

Thank Brenden! my webpart is a form. As your answer, I could not re-use the form control (/CMSFormControls/Captcha/Recaptcha.ascx) for my webpart and I have to use < cms:RecapthcaControl > then re-use some code of the form control, right?

@Hozefa, your link is posted before Kentico 8 release and now I am using Kentico 8, so I asked to re-use new form control "reCaptcha" in Kentico 8 for my page.

Thank all.

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on January 22, 2015 18:14

Giang le, yes you could pretty much copy the code in that form control and use it in your webpart. Some items may be specific to the form control which you'll have to find a work around for. But at minimum you will have to register those script blocks.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.