Skip to content
● Meet Grav Guard: keep every Grav site you run secure and up to date, all from one place. Free for up to 3 sites. Read more →

Does basic-captcha need a secret?

form

Solved by pamtbaau View solution

Started by Gero Krüger 4 years ago · 3 replies · 1584 views
4 years ago

I want to use basic-captcha in a form.md (for several reasons I don't want google's reCaptcha). Now I get the crikey "RuntimeException: No secret provided". I think I don't need a secret for basic-captcha?!

4 years ago Solution

@geradok,

I think I don’t need a secret for basic-captcha?!

I think you're right...

Using a fresh install of latest Grav:

  • Created a contact form
  • Followed the docs for the Basic Captcha field:

    • Added the Basic Captcha field to the form
    • Added the proper process entry to the form
    YAML
    ---
    title: Basic Captcha
    form:
    name: captchaform
    fields:
      name:
        type: text
      basic-captcha:
        type: basic-captcha
        placeholder: copy the 6 characters
        label: Are you human?
    buttons:
      submit:
        type: submit
    process:
      basic-captcha:
        message: Humanity verification failed, please try again...
    ---
    

Form is working fine.

Untitled|690x403

4 years ago

Thank you so much! I learned that the NAME of the element (not only the TYPE) has to be 'basic-captcha' and not 'captcha', which is to me a little bit unexpected. My (not working) version was:

YAML
    captcha:
        type: basic-captcha
        placeholder: copy the 6 characters
        label: Are you human?
  buttons:
    submit:
      type: submit
      value: Submit
  process:
    captcha:
      message: Try Again!
4 years ago

@geradok, I don't think your assumption is correct. It is the name of the process variable that must be basic-captcha. That process variable tells the form how the submitted form should be processed.

Suggested topics

Topic Participants Replies Views Activity
Forms & Blueprints · by Anna, 2 days ago
2 51 15 hours ago
Forms & Blueprints · by Anna, 3 days ago
7 81 15 hours ago
Forms & Blueprints · by Anna, 1 week ago
5 185 6 days ago
Forms & Blueprints · by TomW, 1 month ago
3 377 1 month ago
Forms & Blueprints · by Japhy, 2 months ago
2 593 2 months ago