Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi
I have Botcha on form that is located on block that is loaded via AjaxBlocks drupal.org/project/ajaxblocks
The thing is that it's not being hidden, because page isn't reloaded.
Can You do something with that or advice me something??
Comments
Comment #1
iva2k CreditAttribution: iva2k commentedI am pretty sure Botcha won't work for any form served via AJAX, as it requires running custom javascript generated for each form. AJAX forms don't run javascript or load additional CSS.
I'm moving this to a feature request. I know how to make it work (with prepared page-wide recipes on the page for all AJAX forms and detecting use of AJAX), but it will take time which I currently don't have.
Comment #2
barteque CreditAttribution: barteque commentedI made a little modification to the botha module [my local copy]
a put some inline javascript which is hiding the "field that should be hidden"
but that way the field is not being properly filled in... :/
Comment #3
iva2k CreditAttribution: iva2k commentedComment #4
hles CreditAttribution: hles commentedComment #5
ryoken CreditAttribution: ryoken commentedThanks for this great module!
Using BOTCHA with Webforms module works fine, except when you have a file attachment/upload widget - this appears to be AJAX-based. It would be nice if I could get file upload fields working with BOTCHA.
Comment #6
PatchRanger CreditAttribution: PatchRanger commentedVersion 7.x-2.x now has "AJAX friendly" recipe book, which consists of only non-JS recipes. It makes it playing nice with AJAX and so on.
#1832232: Make the BOTCHA module to work with AJAX comment module closed as a duplicate of this thread.
Comment #7
PatchRanger CreditAttribution: PatchRanger commentedThe great leap to this functionality is here: #1849182: [META] Add Selenium tests for JavaScript recipes full test coverage. When it gets closed, we'll have a plan (I hope) how to achieve this.
Comment #8
Aurochs CreditAttribution: Aurochs commentedUnfo Botcha breaks my javascript. Unfo i understood that too late and spent 2 days giguring out the problem!
So i will turn back to the module which is meant for merging - uncaptuolous + spamicide+honeypot.
That three in combination dont give me troubles neither with spam nor with js.
will be looking forward to botcha working with js.
Comment #9
PatchRanger CreditAttribution: PatchRanger commented@Aurochs First of all thanks a lot for reporting the problem - it helps to make the module even better.
That's really unfo. Right now I am working on #1849182: [META] Add Selenium tests for JavaScript recipes full test coverage, which will let to fix the root of such kind of problems. The plan is as follows:
Comment #10
PatchRanger CreditAttribution: PatchRanger commentedClosed #1859262: content/js_add_more for add another item gives error as a duplicate of this one.
Comment #11
PatchRanger CreditAttribution: PatchRanger commentedClosed #1880198: Botcha breaks file uploads as a duplicate of this one.
Comment #12
sororitypin CreditAttribution: sororitypin commentedAnyone working on this?
Comment #13
iva2k CreditAttribution: iva2k commentedNot that I know of. I will give priority to reviewing submitted patches.
Comment #14
tomogden CreditAttribution: tomogden commentedI'm not sure I follow where this issue has gone.
Let me describe my own use case to make this issue a little more searchable and attract some helpful attention:
As to a solution, I don't know what has been considered, but the simple method would be to add a checkbox in the configuration page that says something like, "Allow AJAX in BOTCHA forms." This checkbox in turn would deactivate the 'no_cache' flag. Since forms caching is considered a security measure, I don't quite understand why it's used at all in BOTCHA.
Any feedback?
Comment #15
tomogden CreditAttribution: tomogden commentedIt appears to be work in 7.x-3.x-dev.
Comment #16
tomogden CreditAttribution: tomogden commentedMy mistake. The only way 7.x-3.x-dev will all for AJAX is if the given form is disabled, which is no help at all.
The new 3.x organizes tests into recipes within recipe books, including a recipe book that is called "AJAX friendly". Unfortunately, the 'no_cache' call is in the apply() function that handles all BOTCHA-enabled forms, regardless of recipe, and even if the recipe book selection is "none".
The 'no_cache' setting was introduced in #1510082-1: BOTCHA D7: form rebuild is not happening properly on invalid submission.
As @iva2k put it,
Comment #17
jun CreditAttribution: jun commentedI'm afraid I've found an AJAX form use that doesn't play well with BOTCHA. Using Inline Entity Forms widgets in their Multiple Values mode breaks. The way it breaks is that clicking on the Add Existing Node or Add New Node buttons simply doesn't do anything.
My setup uses the Inline Entity Form as a Profile2 field displayed in the user_registration_form. It works fine without Botcha enabled.
Enabling the Botcha module breaks the form right away. Configuring the form for Ajax Friend recipes doesn't fix it, and neither does choosing "None" as a Recipe.
Comment #18
iva2k CreditAttribution: iva2k commentedAfter reading it carefully, #17 seems like a different issue. Please open a separate issue for the very special case, otherwise you may wait a much longer time to get it fixed.
Comment #19
burningdog CreditAttribution: burningdog commentedI have the same issue with hierarchical_select - drupal tries to look up the form id in the
cache_form
by callingajax_get_form()
- which loads up the cached form through the following line in form_get_cache():My value of form_build_id is
form-LZmfUB5y3Y9rM21HepB9_f13xlST99Xj6SwAGP4jlLw
but in thecache_form
table it's prefixed with "botcha", so that it isbotcha_form-LZmfUB5y3Y9rM21HepB9_f13xlST99Xj6SwAGP4jlLw
.So how we fix this - I have no idea. 2 years ago iva2k had an idea at #1.
Comment #20
ARUN AK CreditAttribution: ARUN AK commentedHi,
I am using Asaf (ajax submit for any form) module for ajax form submission and I have enabled ajax submission for comment form.
But if enable the botcha for a ajax enabled form then ajax submission will not working. I tried to change recipe in to AJAX friendly, but still it is not working. Please help me.
Thanks and Regards
ARUN AK
Comment #21
jcmartinezIt would be great if someone (...or iva2k) could explain a bit more the idea at #1. I'd be happy to put some effort into a fix and a patch but at this point and with so limited information it is not clear to me how to fix it.
BTW - As suggested on https://drupal.org/node/1561468, I tried adding this...
...to my hook_form_alter() but it did not help.
Comment #22
iva2k CreditAttribution: iva2k commentedThe idea I mentioned in #1 is a multi-step development.
1. Change the mechanism Botcha uses to modify forms - move the logic from form_alter to one (or few) of hooks that are called later in the process. Code in Mollom captcha can be used as a template. (Background info: Botcha used code found in contrib Captcha module. Mollom came later with a different and better technique as it is done by Dries).
2. Once item 1 is done, AJAX handling hooks have to be added to Botcha. Details for this I don't remember as I looked at it long time ago. Basically we need to transport new AJAX and CSS code to the form via all AJAX updates. Mollom code may give some ideas.
3. Create/modify recipes to work with AJAX hooks.