Problem/Motivation

drupalSettings variable is not updating if we render a form with Ajax. So it is getting "Cannot set Property human of undefined" error

Steps to reproduce

1. Enable Antibot to a web form (any form)
2. Render the form with an ajax request
3. and Submit the form, you will get Javascript not enabled in the browser error (even if it is enabled)
Before the on the form load, getting js error as mentioned above.

Proposed resolution

When we render an element through ajax we will call attachBehaviors with the new elements and settings. So in the antibot.js attach function should receive new settings and use it as a drupalSettings.

CommentFileSizeAuthor
#4 3205217-1.patch686 bytesleopathu
#2 3205217.patch664 bytesleopathu

Issue fork antibot-3205217

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

leopathu created an issue. See original summary.

leopathu’s picture

Status: Active » Needs review
StatusFileSize
new664 bytes

Attaching a patch to be fixed the issue.

guilhermevp’s picture

Status: Needs review » Needs work
leopathu’s picture

Status: Needs work » Needs review
StatusFileSize
new686 bytes

I hope this patch will apply successfully.

gaurav.kapoor’s picture

Version: 8.x-1.4 » 8.x-1.5
gaurav.kapoor’s picture

Getting this error when running tests as well.

gaurav.kapoor’s picture

Status: Needs review » Needs work
gaurav.kapoor’s picture

Version: 8.x-1.5 » 2.0.x-dev
diegors’s picture

Assigned: Unassigned » diegors

I will work on this.

diegors’s picture

Assigned: diegors » Unassigned
gquisini’s picture

Assigned: Unassigned » gquisini

I'll try to work on it

gquisini’s picture

Assigned: gquisini » Unassigned
jsricardo’s picture

Assigned: Unassigned » jsricardo

I will try work on it

jsricardo’s picture

Assigned: jsricardo » Unassigned

Sorry, I didn't make progress on this task

joegraduate’s picture

We've been using the patch from #4 without issues on sites running 2.0.0 for some time now. Are there specific problems folks are still seeing with this patch applied?

joegraduate’s picture

Status: Needs work » Needs review
christyanpaim’s picture

Assigned: Unassigned » christyanpaim
christyanpaim’s picture

Assigned: christyanpaim » Unassigned
joegraduate’s picture

Status: Needs review » Reviewed & tested by the community

We're still using this patch on a large number of sites without any issues (see #15).

danrod’s picture

Thanks for the patch !

I tested this and works as expected, I was able to do a webform submission (the webform was set to use an AJAX request for all submissions) and worked fine, no errors seen in the browser console.

There are some issues when running the tests on this module (mentioned in the comment #6), but I'll address these issues in a separate issue: https://www.drupal.org/project/antibot/issues/3392673

I'll commit this to the 2.0.x branch.

Moving this to "Fixed"

danrod’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.