Are all forms created by webform module automatically taken care of, or do we have to add each form id in configuration?

CommentFileSizeAuthor
#5 webforms_special_form_id-1863514-5.patch2.43 KBhctom
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

PatchRanger’s picture

Title: Do we need to add each webform in botcha config? » List all webform forms at admin/config/people/botcha/form also
Component: Miscellaneous » Code
Category: support » feature

Answering your question: yes, right now you need to add each webform form manually. The table at admin/config/people/botcha/form includes all forms that are known by BOTCHA - so if there is no some concrete form then you should add it.
Let's turn it into a feature request: I think it makes sense to add webform forms to the list (though I think we shouldn't protect them by default - just list them).

PatchRanger’s picture

By the way (I will not get tired mentioning it):
If you are interested in getting this issue closed - please consider donating using PatchRanger service. Each donation - is in fact a bounty which developers will be rewarded with after fixing the issue. For more details see http://drupal.org/project/botcha#how-much-does-it-cost.

millenniumtree’s picture

Issue summary: View changes

How about an option to add botcha to all webforms?
What about a wildcard in the form ID?
That way you just enter a form ID of 'webform_client_form_*' and you're done.

hctom’s picture

Version: 7.x-2.0 » 7.x-3.x-dev

IMHO the special webform_client_form_* form ID absolutely makes more sense than listing all webforms by default. We work for a portal page that hosts hundreds or even thousands of contest forms utilizing the webform module. If all these form IDs would have been listed on the BOTCHA admin page, it won't be accessible anymore because of tons of data.

The above stated special form ID should be enough to protect all webforms. It is unique (especially because of the "*" character in it, which no other form ID will ever have) and so it should be easy to filter that case in the BotchaFormController::isEnabled() method.

I will provide a patch for that in the next comment for the 7.x-3.x-dev branch, because we urgently need this feature.

EDIT: Unfortunately the above stated special form ID collides with the validation of allowed input of form IDs and I guess it is not the best name, because this will also be used for the botcha_enabled_FORM_ID variable name. So I suggest the following special ID: __webform_client_form__all__.

hctom’s picture

Status: Active » Needs review
Issue tags: +Needs followup, +Quick fix
FileSize
2.43 KB

Attached you can find a patch which provides the special __webform_client_form__all__ form ID handling to target all webforms at once. Nevertheless with this implementation it is still possible to create different configs for special webforms by their real form ID, which will always take precedence over the special form ID.

NOTE: This should work as a quick fix, but for the future there should be something better like regular expression handling or similar. Unfortunately this would change a lot in the current API (e.g. enabled status cannot be saved in a variable anymore having the form ID in its name - this may be solved to move this information into the corresponding row in the botcha_recipebook_form table or another specific table containing this information), so there should be a follow up issue to make this more robust.

I'd appreciate your feedback on my proposed quick fix solution.

Akshita’s picture

Hi

My apologies first for posting this question here. I have installed Botcha and its dependencies on dev environment. Not I am not sure how to test my webform to make sure botcha is working.

Any help is highly appreciable.

Thanks
Rev