How to install Recaptcha on CGBetterForm

A place to make for-pay "CMS made simple" job offerings
Locked
Mich-adg
Forum Members
Forum Members
Posts: 199
Joined: Sat Aug 02, 2008 9:08 pm

How to install Recaptcha on CGBetterForm

Post by Mich-adg »

Hi,
i'm trying to install a Recaptcha (or Invisible Recaptcha) on a CG BetterForm, but with Captcha module active or not (code pasted in the templates directly) i can't achieve it.
It seems that the submit function doesn't take care at the Captcha state.
If anybody has an example of working integration... !!
Thanks for help !
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1609
Joined: Wed Feb 25, 2009 4:25 am
Location: Victoria, BC

Re: How to install Recaptcha on CGBetterForm

Post by DIGI3 »

I'd be happy to help you out with this directly if you get stuck, but I think you just need to add the default validators. (Validation tab, click on "auto add validations" then save your form.
Not getting the answer you need? CMSMS support options
Mich-adg
Forum Members
Forum Members
Posts: 199
Joined: Sat Aug 02, 2008 9:08 pm

Re: How to install Recaptcha on CGBetterForm

Post by Mich-adg »

Hi, thanks for replying !

I got these validators yet :
Detect HTML tags in form input
Validate the value of select fields
Validate that all required fields are present
Ensure a reasonable value for all email fields

But i can still send the form without checking the box " i'm not a robot " from recaptcha.

My Form template:

Code: Select all

<form>

  <div>
     <label for="myname">Name</label>
     <input id="myname" class="form-control" name="name" value="{$form_data->name}" required/>
  </div>

  <div>
     <label for="myemail">Email</label>
     <input id="myemail" class="form-control" type="email" name="email" value="{$form_data->email}" required/>
  </div>

  <div>
     <label for="comments">Comments</label>
     <textarea id="comments" class="form-control" name="comments" required>{$form_data->contents}</textarea>
  </div>

  <div class="g-recaptcha" data-sitekey="mykey"></div>

  <div>
    <button type="submit" class="fdorange">Send</button>
  </div>
</form>

The div containing the captcha :

Code: Select all

<div class="g-recaptcha" data-sitekey="mykey"><div style="width: 304px; height: 78px;"><div><__iframe src="https://www.google.com/recaptcha/api2/anchor?ar=1&k=...></__iframe></div><textarea id="g-recaptcha-response" name="g-recaptcha-response" class="g-recaptcha-response" style="width: 250px; height: 40px; border: 1px solid rgb(193, 193, 193); margin: 10px 25px; padding: 0px; resize: none; display: none;"></textarea></div></div>
In the head:

Code: Select all

<__script__ src="https://www.google.com/recaptcha/api.js" async="" defer=""></__script>
Is something missing? ::)
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1609
Joined: Wed Feb 25, 2009 4:25 am
Location: Victoria, BC

Re: How to install Recaptcha on CGBetterForm

Post by DIGI3 »

Oh I didn't notice you weren't using the Captcha module. No idea then.
Not getting the answer you need? CMSMS support options
Mich-adg
Forum Members
Forum Members
Posts: 199
Joined: Sat Aug 02, 2008 9:08 pm

Re: How to install Recaptcha on CGBetterForm

Post by Mich-adg »

I retried with the Captcha Module on, and same result ! I can send the form without checking the box :s
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1609
Joined: Wed Feb 25, 2009 4:25 am
Location: Victoria, BC

Re: How to install Recaptcha on CGBetterForm

Post by DIGI3 »

With the Captcha module installed there's a few steps you have to do:
-configure the Captcha module
-edit your CGBF form template to include the captcha tag and error display items (see the cgbf docs and/or the sample form templates)
-re-add the the auto validations. If the captcha tag (not captcha code, but the cgbf-specific captcha tag) is detected in your form template, the captcha validation will be added.
Not getting the answer you need? CMSMS support options
Mich-adg
Forum Members
Forum Members
Posts: 199
Joined: Sat Aug 02, 2008 9:08 pm

Re: How to install Recaptcha on CGBetterForm

Post by Mich-adg »

Oh, it works now with your steps to do! Many many thanks !! ;)
Locked

Return to “Help Wanted (commercial)”