I get this error when i try to add a new validation rule for is empty...

Error: Call to undefined function webform_component_list() in webform_validation_get_webform_components()

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dob_ created an issue. See original summary.

Liam Morland’s picture

I am not seeing this. Please try the latest development version. If that does not fix it, please provide steps to reproduce.

Liam Morland’s picture

Status: Needs work » Active

"needs work" is for issues that have a patch.

kiseleva.t’s picture

This patch solves problem for me.

Liam Morland’s picture

Can you provide steps to reproduce the problem? I don't see it.

kiseleva.t’s picture

This error appears when I try to add any validation rule.
For example: node/NID/webform/validation/add/someofseveral

Liam Morland’s picture

I don't understand how this could happen. Webform should already be loaded. Do you have any other Webform-related modules installed? Does it fix it to use module_load_include() instead of form_load_include()?

Does anyone else have this problem?

m.lebedev’s picture

I have the same error!

jh3’s picture

Same problem. Using webform 7.x-4.7.

Webform and webform validation are the only two webform related modules I have installed.

I have not fully debugged this issue, but webform_component_list() is in webform.components.inc. The .inc file is loaded only in certain cases within the webform module. My assumption is that the menu path for adding a validation rule (e.g. node/%nid/webform/validation/add/regex) is not one of these cases. This is why webform.components.inc needs to be explicitly loaded before calling webform_component_list().

form_load_include() works in this case because webform_validation_get_webform_components() is called from a form.

See https://api.drupal.org/api/drupal/includes%21form.inc/function/form_load...

Use this function instead of module_load_include() from inside a form constructor or any form processing logic as it ensures that the include file is loaded whenever the form is processed. In contrast to using module_load_include() directly, form_load_include() makes sure the include file is correctly loaded also if the form is cached.

webform_validation_get_webform_components() is also in a .inc file.

The patch from #4 works, but $form_state should probably be passed to webform_validation_get_webform_components() so that it can then be passed into the form_load_include() call.

conniemh’s picture

We see the same error when trying to edit or add a webform validation for a field. The patch from #4 allows us to edit or create new field validations. I do not code, so thanks to you all for working on permanent fixes. This is our platform in case it helps:
Webform 7.x-4.14
Webform Validation 7.x-1.13
Drupal 7.53
php 5.5.9
mysql Ver. 14.14 Distrib 5.5.52

seyfcom’s picture

I have the same error...
webform_validation-undefined-function-2847302-4.patch
helped me! fixed!

Liam Morland’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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

Gonzalo2683’s picture

I have the same problem, the #4 entry solve my problem.