Page 1 of 1

BetterForms keeps asking for Captcha

Posted: Fri Sep 25, 2020 2:02 pm
by rooon
Hi all,

I have the following BetterForms template. The UDT "better_forms_errors" checks if there is dirty stuff in the form fields and returns this in an array. First, I did have the Captcha <div> in the template but I removed ihe Captcha module (uninstall and remove files). So I did also remove the Captcha <div> line from the template. But now, after a scan, BetterForms keeps asking for the Captcha line in the template.

"NOTICE: No captcha container was detected in the form markup."

Any suggestion is welcome.

Code: Select all

{cgbf_form_errors assign='errors'}{strip}
{better_forms_errors errors=$errors assign="ErrArray"}
{$fieldErr = $ErrArray["strSumErr"]}
{/strip}{if !empty($errors)}
<div class="mt-2 alert alert-info form-summary">
<ul class="bf-alert list-unstyled">
{if ($ErrArray["errCaptcha"])}<li>De captcha code komt niet overeen.</li>{/if}
{if ($ErrArray["errEmail"])}<li>Het emailadres is niet correct.</li>{/if}
{if ($ErrArray["errUpload"])}<li>Uploaden van het bestand is niet gelukt.</li>{/if}
{if ($ErrArray["errInvalid"])}<li>Velden voldoen niet aan criteria: {$ErrArray["strInvalid"]}</li>{/if}
{if ($ErrArray["errAllowed"])}<li>Linkje of email niet toegestaan: {$ErrArray["strAllowed"]}</li>{/if}
{if ($ErrArray["errOther"])}<li>{$ErrArray["strOther"]}</li>{/if}
</ul>
</div>
{/if}
<form id="form1" novalidate>

<div class="form-group form-row bf-text01">
<div class="col-12">
Uitgebreid kan ik je informeren over de begeleiding die het beste bij je past. Vraag gerust om meer informatie. Graag tot ziens!
</div>
</div>

<div class="form-group form-row bf-naam{if $fieldErr|stripos:'naam' !== false} bf-error{/if}">
  <div class="col-sm-2 col-form-label">Naam</div>
  <div class="col-sm-10 pt-2 pb-1">
    <div class="form-check form-check-inline">
      <input type="radio" name="geslacht" id="geslacht_1" value="Dhr." checked>
      <label for="geslacht_1"><span></span>Dhr.</label>
    </div>
    <div class="form-check form-check-inline">
      <input type="radio" name="geslacht" id="geslacht_2" value="Mevr.">
      <label for="geslacht_2"><span></span>Mevr.</label>
    </div>
  </div>
  <label for="naam_0" class="col-sm-2"><span class="sr-only">Naam</span></label>
  <div class="col-sm-10 py-1">
    <input class="form-control form-control-sm" name="naam" id="naam_0" type="text" placeholder="* Nicole Hendriks" >
  </div>
</div>

<div class="form-group form-row bf-email{if $fieldErr|stripos:'email' !== false} bf-error{/if}">
  <label for="email_0" class="col-sm-2 col-form-label">Emailadres</label>
  <div class="col-sm-10">
    <input class="form-control form-control-sm" name="email" id="email_0" type="email" placeholder="* nicole@gmail.com">
  </div>
</div>

<div class="form-group form-row bf-telefoon{if $fieldErr|stripos:'telefoon' !== false} bf-error{/if}">
  <label for="telefoon_0" class="col-sm-2 col-form-label">Telefoon</label>
  <div class="col-sm-10">
    <input class="form-control form-control-sm" name="telefoon" id="telefoon_0" type="text" placeholder="071 1234567">
  </div>
</div>

<div class="form-group form-row bf-adres{if $fieldErr|stripos:'adres' !== false} bf-error{/if}">
  <label for="adres_0" class="col-sm-2 col-form-label">Adres</label>
  <div class="col-sm-10">
    <input class="form-control form-control-sm" name="adres" id="adres_0" type="text" placeholder="Tulpstraat 173">
  </div>
</div>

<div class="form-group form-row bf-postcode{if $fieldErr|stripos:'postcode' !== false} bf-error{/if}">
  <label for="postcode_0" class="col-sm-2 col-form-label">Postcode</label>
  <div class="col-sm-10">
    <input class="form-control form-control-sm" name="postcode" id="postcode_0" type="text" placeholder="2252 VA">
  </div>
</div>

<div class="form-group form-row bf-woonplaats{if $fieldErr|stripos:'woonplaats' !== false} bf-error{/if}">
  <label for="woonplaats_0" class="col-sm-2 col-form-label">Woonplaats</label>
  <div class="col-sm-10">
    <input class="form-control form-control-sm" name="woonplaats" id="woonplaats_0" type="text" placeholder="Voorschoten">
  </div>
</div>

<div class="form-group form-row bf-bericht{if $fieldErr|stripos:'bericht' !== false} bf-error{/if}">
  <label for="bericht_0" class="col-sm-2 col-form-label">Bericht</label>
  <div class="col-sm-10">
    <textarea class="form-control" name="bericht" id="bericht_0" placeholder="* Mijn vraag" rows="8"></textarea>
  </div>
</div>

<div class="form-group form-row bf-submit{if $fieldErr|stripos:'captcha' !== false} bf-error{/if}">
  <div class="col-12 pt-2">
    <button class="btn float-right" type="submit">Verstuur</button><!--disabled="disabled"-->
    <button class="btn float-right formModal-btn mr-3" type="button" name="form1help"> &#9432; </button>
  </div>
</div>

</form>

Re: BetterForms keeps asking for Captcha

Posted: Fri Sep 25, 2020 4:42 pm
by DIGI3
Under the Validation tab, perhaps you still have the "Validate Captcha" item? I haven't tested if that returns an error if no captcha div is present, but seems possible.

Re: BetterForms keeps asking for Captcha

Posted: Fri Sep 25, 2020 5:52 pm
by rooon
There are no validation rules. I removed the contactform and created a new one. The problem is still there.

Re: BetterForms keeps asking for Captcha

Posted: Fri Sep 25, 2020 7:17 pm
by velden
Looking at the code it seems like the captcha is required unless you have a <p> element in the form with a data-cgbf-nocaptcha attribute.
I guess something like

Code: Select all

<p data="cgbf-nocaptcha"></p>

Re: BetterForms keeps asking for Captcha

Posted: Fri Sep 25, 2020 7:57 pm
by rooon
@velden. Thanx for your help, it works! I used this:

Code: Select all

<div data-cgbf-nocaptcha></div>
The same line as data-cgbf-captcha but now using "nocaptcha"

Lazy me ;) I'm pretty sure it's in the documentation

Re: BetterForms keeps asking for Captcha

Posted: Sat Sep 26, 2020 8:30 am
by velden
You're right of course about both the attribute and div is allowed too, missed that.

I checked documentation before posting but didn't find the explicite notes about NOT using captcha.

Good to hear it's solved now.