Skip to content

Honeypot functionality is not working #438

@ajoliveau

Description

@ajoliveau

Description

GravityForms allow admins to enable Honeypots on forms. What this does is that when it renders a form, it adds a hidden input. When it validates a form submission, if this input has a value, it must have been automatically filled by a bot so the entry is discarded.

When using Graphql and a headless implementation of the form, what I wanted to do is add the hidden input manually to my forms, and sent it to Gravity Forms so it can validate the submission and I have nothing to handle in the backend.

But the way GF handles this honeypot field is that if the honeypot is enabled for the form, it creates a "virtual" field, it's not part of the form main fields like a captcha would be, but GF instead renders a field with its ID being "the highest ID + 1"

So if I have 12 fields, input going from 1 to 12, the honeypot field name for Form 1 would be something like input_1_13

If I try to manually submit a honeypot field value to the submitGfForm mutation, I get an error The form (ID 1) does not contain a field with the field ID 13, even though I'm pretty sure GF would accept this field.

Steps to reproduce

  1. Create a form, add one field (id = 1)
  2. Enable the Honeypot feature for the form
  3. Do this query
mutation {
  submitGfForm(
    input: {id: 1, fieldValues: [
      {id: 1, value: "text field"},
      {id: 2, value: "honeypot field, GF should discard or flag this entry"}
    ]}
  ) {
    confirmation {
      type
      message
    }
  }
} 
  1. Get an error message from wp-graphq-gravity-forms instead of a success message

Additional context

No response

Plugin Version

0.12.6

Gravity Forms Version

2.7.17

WordPress Version

6.3

WPGraphQL Version

1.14.3

Additional enviornmental details

php8.1

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have disabled ALL plugins except for Gravity Forms, WPGraphQL, and WPGraphQL for Gravity Forms

  • Yes
  • My issue is with a specific 3rd-party plugin.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions