This module seems to have a hard-coded idea about containers.
The only "container" type shipped with the core webform module is the fieldset, but add-ons can provide others using webform's hooks.
I recently wrote a module that does just that, and this module fails to recognize any field placed in such a container.

Comments

tedbow’s picture

Priority: Normal » Minor
Status: Active » Postponed (maintainer needs more info)

Please provide a reason you think it might not be working. Also I suggested patch would be great.
I am focusing on getting this module working with basic Webforms now.

matty77’s picture

Version: 6.x-1.x-dev » 6.x-1.1
Status: Postponed (maintainer needs more info) » Needs work

This is also not working for me.

Example: I created a "webform layout" container with two fields inside; one of these fields is conditionally dependent on a field outside the container. The observed behavior is not as expected, both fields will be displayed regardless of the condition set in webform conditional. In other words webform conditional is not working on non fieldset containers.

Enzomaticus’s picture

I have noticed this in 7.x-1.0-beta1 as well. When the dependent field is inside the webform layout container the field it is dependent on has to be outside the webform layout container.

matty77’s picture

Still looking for a solution on this if anyone has ideas.

A webform can not be submitted when fields are placed within a "layout_box" and that "layout box" is hidden because of a dependency set up through webform conditional. When the fields are moved out of the layout box they work as they should; meaning when they are hidden it is not mandatory that they be filled to submit the form.

caseyboardman’s picture

Issue summary: View changes

Since it looks like this module is going away, but people other than myself are still using it, I have this quick-and-dirty patch:

Add this code in webform_conditional_element_after_build in the if ($was_hidden) block:

      //deal with layout_box types
      if (isset($form_element['#webform_component']['type']) && $form_element['#webform_component']['type'] == 'layout_box') {
        foreach ($form_element as &$element) {
          //one level of depth is enough, as webform_grid won't go further
          if (is_array($element) && isset($element['#required'])) {
            $element['#required'] = FALSE;
          }
        }
      }
omerida’s picture

This also affects addressfield components

steeph’s picture

Project: Webform Conditional (Same Page Conditionals) » Webform
Version: 6.x-1.1 » 7.x-4.x-dev

Looks like this came back with the recent Webform update. Conditionals do not work any longer for Layout Boxes.

steeph’s picture

Title: Doesn't work with non-fieldset containers » Conditionals don't work with non-fieldset containers
danchadwick’s picture

Project: Webform » Webform Conditional (Same Page Conditionals)
Version: 7.x-4.x-dev » 6.x-1.1

Please don't re-open a old issue for D6 and change it to D7 and move it to a different issue queue. Instead, open a new issue in the webform issue queue and link it to this one using the related issues field.

Even though you changed the version to webform 7.x-4.x-dev, I suspect that you didn't actually try it with the latest dev, but instead tried it with 7.x-4.5. This version has a javascript error might might explain the problem. I don't think there is any code that is specific to fieldsets. It relies on a parent component id to establish the hierarchy. An exception is pagebreaks which receive special treatment.

steeph’s picture

You're right. This wasn't a good choice. Thanks for setting it back.

danchadwick’s picture

My testing with webform layout shows that the latest dev works fine now.