Closed (outdated)
Project:
Antibot
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
9 Aug 2018 at 08:41 UTC
Updated:
7 Dec 2025 at 16:54 UTC
Jump to comment: Most recent
Comments
Comment #2
weseze commentedComment #3
mstef commentedWhat versions of each module are you using?
Comment #4
weseze commentedlatest official releases
Comment #5
mstef commentedSounds more like a webform issue. If not, please reopen.
Comment #6
weseze commentedIt is actually an antibot issue.
Problem is the form id's where antibot should be active are listed in an array in php code and passed on to javascript.
Other modules are allowed to make changes to form id's using all sorts of hooks en templates. So the id's from php code might not match those in JS settings.
It would be fixed by getting all forms with an antibot class on instead of relying on id's calculated in PHP.
Comment #7
mstef commentedIf the ID changes that far down the line, the hidden key will not work either. I've never heard of a form ID changing and cannot think of a reason why that would be.
Comment #8
weseze commentedWat kind of patch would you accept?
1/ Change the logic in JS so it does not work directly on id's anymore
2/ Increase this modules weight so it runs after uuid/webform modules
Comment #9
mstef commentedChanging the weight to affect the order or hook invocation died out in D6. I would gladly accept the addition of https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Extension... to move antibot to the end of hook_form_alter(). I'm not entirely sure that will fix your issue though, since most of what antibot does is in a pre_render callback. But it's worth a try. The hook is available in D7 and D8.
Comment #10
mstef commentedComment #11
weseze commentedMoving it to the end does not fix the problem... As you said most of the magic happens in the pre_render and the damage with changing form_id's happens later on in the uuid module.
I'm currently using these 2 alterations in a custom module to guarantee compatibility between antibot-webform-uuid:
Could something like this be included in the antibot module?
I understand uuid module is ultimately the cause of the error, but I feel that any module that might change a form_id and happens to run after antibot (which is likely ;)) can cause the same error. So with that in mind the fix really should be in antibot itself?
Comment #12
mstef commentedI understand how you think it should be on antibot to catch these types of changes, but I don't know that form IDs are supposed to change at all - and if we were going to change antibot to handle it, we certainly cannot be checking for a specific contrib doing a specific thing; it would have to be a more generic approach, such as moving the logic to as close to the end as possible.
Perhaps adding the module implements alter hook to push it to the very end, then moving all of the form alter code in to the pre render? Not sure if that works at all, but try it out.
Comment #14
jurgenr commentedI agree that it's bad practice to change a form ID but as Drupal 7 allows changing it situations like this can happen with any module.
Would it be an option to switch from form ID's to an antibot specific data attribute?
Comment #15
mstef commentedI would recommend first trying what I suggested.
Comment #16
weseze commented@mstef: moving all logic from the prerender to the form_alter does not work. Implementing a hook_module_implements_alter on top of it also does not work.
Using the suggestion from @JurgenR with a data attribute does work.
I've added this code to antibot.module:
so the entire function now looks like this: (anitbot.module)
And in antibot.js I have change the below function to work with this data attribute instead of id
Comment #17
mstef commentedCan you point out where in webform/uuid the form ID is actually changed?
Comment #18
mstef commentedComment #19
avpadernoComment #20
danrodWon't fix, 7.x is not supported anymore.
Comment #21
danrodComment #22
danrodComment #23
danrod