I am having an issue that no matter how I set up my conditionals, all the fields are shown. I just uninstalled Webform Conditionals module after updating to webform-7.x-4.7. Then after reading this post https://www.drupal.org/node/2475469 updated to webform-7.x-4.x-dev (2015-Apr-26). I'm not seeing any difference. All the fields are shown. I am attaching a screenshot of my conditional rules and a test form is here: http://everettkelley.com/forms/test-form

I am not seeing any javascript errors on this as Dan Chadwick mentioned looking for.

Thanks for any help!

CommentFileSizeAuthor
Screen Shot 2015-04-27 at 4.28.55 PM.png26.48 KBLaurenW
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

LaurenW’s picture

Issue summary: View changes
DanChadwick’s picture

I was in the midst of debugging your site when it went off-line.

You have a javascript error:

Drupal.webform.conditionalCheck = function(e) {
  var $triggerElement = $(e.target).closest('.webform-component');
  var $form = $triggerElement.closest('form');
  var triggerElementKey = $triggerElement.attr('class').match(/webform-component--[^ ]+/)[0];
  var settings = e.data.settings;
  if (settings.sourceMap[triggerElementKey]) {
    Drupal.webform.doConditions($form, settings);
  }
};

$triggerElement is null, meaning that a change event was found on an element which was not within an element with the 'webform-component' class. I didn't get far enough to see what was going on, but I'm suspecting a theme issue -- perhaps not all the required webform classes are present.

If you would like further help, please get the site back up. Also please disable CSS and JS aggregation and compression.

DanChadwick’s picture

Status: Active » Fixed

Whatever module you are using to make the column 2 is messing up the classes that webform needs.

For example, on page:
http://everettkelley.com/discover-opportunity/submit-resume

The "General submission or specific position" question is a div:

<div id="webform-component-column-2--general-submission-or-specific-position" class="form-item webform-component webform-component-radios">

There should be a webform-component--FORM_KEY class and instead there is a webform-component-column-2--FORM_KEY id.

By contrast, here's a working example:

<div class="form-item webform-component webform-component-radios webform-component--my-select">

Notice a) no id and b) the class webform-component--select. The form key for this component happens to be "my_select".

EDIT: Corrected some id/class confusion.

LaurenW’s picture

But my test form (http://everettkelley.com/forms/test-form) does not use columns and still does not work. I am not aware that I did anything to change the classes or IDs that webform puts on the divs around the field. The columns I am using in Submit Resume are just fieldsets which I do have a few extra classes on, but these are not affecting the classes on the field divs, only the field sets. This is the div around my 'choose options' select field:

<div class="form-item webform-component webform-component-radios" id="webform-component-choose-options">

Not sure how I would go about changing that ID to a class.

Thanks for your help.

DanChadwick’s picture

Some module or theme is doing it. That ID should be a CLASS and also you are missing a dash after webform-component. There should be two before the FORMKEY.

LaurenW’s picture

Do you have any idea where I would edit the class structure on the fields to correct it or what module might be causing it? I was able to see the conditional working by editing the classes in the browser code inspector.

LaurenW’s picture

I tried to work around the problem by putting a custom class on the field, however I am having an issue there. I can successfully add classes to fieldsets and class to the field inputs, but where I need to add the correct class (webform-component--FORMKEY) is "Wrapper CSS Class" on the field. And no matter what I put in "Wrapper CSS Class" on any field, it does not render on the page.

http://everettkelley.com/forms/testing-form

DanChadwick’s picture

Set your theme to Bartik. Problem gone? Then it's your theme. Go shoot your designer. Twice for good measure.

Problem still there? It's some other module. Start disabling other modules, starting with things that might mess with markup. When you figure out which one, file a indignant issue in its queue.

:)

It can't be THAT hard to figure out which module is butchering the HTML.

Status: Fixed » Closed (fixed)

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

commonpike’s picture

One of the things that might be 'butchering' your html is a civicrm webform payment form.

Its not really 'butchering' things and I wouldnt fix it there. A simple ' if ($triggerElement.size()) {' around the code block fixes it and is not all that ugly. If the event wasn't fired by a webform component, just ignore it.