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.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | 3205217-1.patch | 686 bytes | leopathu |
| #2 | 3205217.patch | 664 bytes | leopathu |
Issue fork antibot-3205217
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
Comment #2
leopathu commentedAttaching a patch to be fixed the issue.
Comment #3
guilhermevp commentedComment #4
leopathu commentedI hope this patch will apply successfully.
Comment #5
gaurav.kapoor commentedComment #6
gaurav.kapoor commentedGetting this error when running tests as well.
Comment #7
gaurav.kapoor commentedComment #8
gaurav.kapoor commentedComment #9
diegorsI will work on this.
Comment #10
diegorsComment #11
gquisini commentedI'll try to work on it
Comment #12
gquisini commentedComment #13
jsricardo commentedI will try work on it
Comment #14
jsricardo commentedSorry, I didn't make progress on this task
Comment #15
joegraduateWe'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?
Comment #16
joegraduateComment #17
christyanpaim commentedComment #18
christyanpaim commentedComment #19
joegraduateWe're still using this patch on a large number of sites without any issues (see #15).
Comment #20
danrodThanks 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"
Comment #21
danrod