Hello,
I have recently updated Webform from 7.x-4.0-alpha9 to the latest stable 7.x-4.0.
I have built a very large, multipage webform on our website with a lot of conditionals. Most of those conditionals still worked after the update, except one where two select boxes should disappear and a fieldset should appear when the conditions were met. I traced the problem with Firebug, and I narrowed it down to line 114 in webform.js:
var $triggerElement = $(e.target).closest('.webform-component');
A fieldset does not have a class webform-component, instead it has webform-component-fieldset. Since the class webform-component could not be found, the execution of webform.js just stopped. So when I changed the above line to...
var $triggerElement = $(e.target).closest("[class*=webform-component]");
...everything worked. If this is the best solution to this problem, could it be in the next release of Webform?
Thanks in advance.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | node-export[8403](1-nodes).1412590710.drupal.txt | 13.21 KB | worldservants |
| 0001-Bugfix-in-Webform-Conditionals.patch | 1.37 KB | worldservants |
Comments
Comment #1
danchadwick commentedCan you please explain a little more? This code is looking for the webform element that triggered the change. Fieldsets don't trigger changes, they only respond to them. Can you give me detailed instructions to construct the simplest possible webform that demonstrates the bug?
And also, when you say "the execution of webform.js just stopped." Do you mean that there was an exception in the firebug console and all javascript stopped? Or that the page did not respond to the triggering change? Or maybe something else?
Comment #2
worldservants commentedOkay, I have made a form that demonstrates the bug and exported the node with Node Export (see the attached file).
When I view this form, I get this exception in the Firebug console:
Comment #3
danchadwick commentedOdd. I imported your node, and when viewing the node and making every possible choice, I get no console error, and in every case line 116 has a valid $triggerElement, which was found in line 114.
I am thinking that your theme may be changing the classes on the triggering elements? Or there is something different in your installation. Please try on a clean installation of just webform. Or re-try is a core theme, maybe?
Since field-sets are never triggering elements, your proposed patch is perhaps concealing another issue, but not fixing the source of the problem.
I am using the lastest -dev, which is 7.x-4.0-dev+4.
I'm closing this as CNR, but I hope that if you figure out what is happening, you'll re-open with more info.