Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Getting Recaptcha to work in UserForms Module


Go to End


12 Posts   8602 Views

Avatar
Happysadhu

Community Member, 33 Posts

1 August 2009 at 10:31pm

Hi,
I've installed the latest versions of these modules, including the spam protection module, in the root folder of my silverstripe installation. The UserForms works fine, but it is not clear to me how to use Recaptcha with it. The"add field" option in the Form tab of Userforms does have a spam protection option, but not a Recaptcha option. When I add the spam protection, no such field appears on the web page. The spam protection field wants me to enter in a question. What type of question does it mean? Is the spam protection field related to Recaptcha?

In short, how do I get Recaptcha to work with UserForms?

Do I have to change the document type of my web pages from XHTML Strict to XHTML Transitional? I've seen that mention in the Forum. But that wouldn't effect the CMS end of how I add and use Recaptcha in my userforms.

Any help is appreciated,

Thanks,
Sam

Avatar
Willr

Forum Moderator, 5523 Posts

1 August 2009 at 11:00pm

Yes you will need to change your validation or edit the file to have a /.

The (Enter Question) text is just the default label text for the cms

Is the spam protection field related to Recaptcha?

Spam Protection is the base class for recaptcha, once you have spam protection installed it provides the code which like recaptcha can insert their validation into.

Avatar
Happysadhu

Community Member, 33 Posts

2 August 2009 at 4:02am

Thanks for the quick reply.

So this would be the right DOCTYPE to enter, correct?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

What do you mean by "or edit the file to have a /." Please give me an example/more detail of this alternative,

Much appreciated,
Sam Miller

Avatar
Happysadhu

Community Member, 33 Posts

2 August 2009 at 5:14am

Hi again,
I changed the DOCTYPE as suggested in my default Page.ss. Still no sign of Recaptcha?

What I'm I doing wrong?
Sam

Avatar
Happysadhu

Community Member, 33 Posts

2 August 2009 at 5:51am

Edited: 02/08/2009 5:56am

Hi again,

I've also tried installing Mollom, first uninstalling recaptcha, to see if I could get that to work with Userforms -- no luck? Nothing shows when I add the spam protection field. I have followed the installation instructions precisely at http://doc.silverstripe.com/doku.php?id=modules:mollom.

The Mollom Key Status report in my CMS says that my "key exists and is working". Yet no go on the front-end.

I am working on a localhost, could that be the problem?

Help...
Sam

Avatar
Willr

Forum Moderator, 5523 Posts

2 August 2009 at 11:01am

Yet no go on the front-end.

Are you still logged in though? Mollom will not display if you are logged into the site.

Avatar
Happysadhu

Community Member, 33 Posts

2 August 2009 at 3:18pm

Hi,
Thanks! Once, I manually logged out of the CMS (lower right), it worked.

Also Mollom works fine with the following doctype:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >

(As recommended in http://doc.silverstripe.com/doku.php?id=html#doctypes for most themes)

Much appreciated,
Sam

PS: I haven't tried again to get Recaptcha to work. For now, I'm satisfied with Mollom.

Avatar
hp777

Community Member, 13 Posts

27 October 2009 at 1:28pm

First sign-up at reCaptcha site get the public and private keys. Next open your "mysite > config.php" file and add
(replace <publickey> & <privatekey> with the keys from reCaptcha )
RecaptchaField::$public_api_key = '<publickey>';
RecaptchaField::$private_api_key = '<privatekey>';

IF you are using this with spam protection module than you need to add the following to your "mysite > config.php" as well
SpamProtectorManager::set_spam_protector("RecaptchaProtector");

place all of this right before the "?>" at the end of your "mysite > config.php" and you should be in business you shouldn't have to change doc type on most new templates

Go to Top