Fieldset won't actually get hidden or shown. The css_id from _webform_conditional_get_css_id() is wrong here. There is no DIV wrapper, you need to select the actual fieldset. See patch.

Comments

zany’s picture

kyleoliveira’s picture

Fieldsets weren't responding to the conditions I was setting. This patch fixes that problem for me. Thanks zany!

Any chance this will get put into an upcoming release tedbow?

densolis’s picture

All,

I am helping Ted with this module and will be talking with him tomorrow (8-30-12). I will bring this to his attention. Either Ted or I will follow up in the next couple of days

Dennis

densolis’s picture

Issue tags: ++patch

@kyleoliveira

I will test out the patch and get back to you I'm pretty new, so it might take me while.

Dennis

densolis’s picture

Assigned: Unassigned » densolis

Hi zany, kyleoliveira

I just completed a re-write of the user documentation. In that process, I exercised the development (7.x-1-dev) version of Webform Conditional module pretty extensively, but I could no duplicate your issue. Since I can not duplicate your issue, I'm not quite sure how to tell if the patch works.

Can you please see if this is still an issue with the 7.x-1.dev version of Webform Conditional. If it is still an issue, can you please provide an exported Webform node with the problem? That would help me immensely. Instructions are here.

Thanks,

Dennis

zany’s picture

Use this module to hide (toggle) a "Fieldset". It won't work because the selector is assumed to be webform-component-SOMEID. But fieldsets actually get a class of edit-submitted-SOMEID. Look at the HTML source of the form.

densolis’s picture

Status: Needs review » Active
StatusFileSize
new5.01 KB

Zany,

I believe that I did the exactly the same thing as you did, but could not repeat your error. You can check out the following link at sixmiletech.com, which does what you want. I have updated the example on the sixmiletech.com site so it is a bit more intuitive. However, the revised example will not be available for a day or so. So I've attached a copy of the webform conditional demo that will be posted to the above sixmiletech.com web site. You can load it via Node Import and try it. You can also try the existing demonstration as it provides the functionally you require.

I would like to get this issue resolved, but I'm going to need your help. Can you please send me an export of the node that has the problem? If you do not know how to export the node, please read these instructions. If you have any questions, please me know and I will be glad to answer those questions.

Dennis

zany’s picture

Denis,

it seems CSS IDs are generated different for you. I'll try to figure this out. Thanks!

zany’s picture

Status: Active » Closed (won't fix)

webform's components/fieldset.inc clearly specifies
'#attributes' => array('class' => array('webform-component-fieldset'), 'id' => 'webform-component-' . $component['form_key']),
but this gets overridden in some setups with a CSS ID of edit-submitted-*form-key*.
I couldn't locate that though.

Closing this.

tedbow’s picture

Status: Closed (won't fix) » Closed (cannot reproduce)
zany’s picture

StatusFileSize
new627 bytes

I can't seem to locate what triggers this behavior. But there is this code in includes/form.inc's form_builder() function:

  if (!isset($element['#id'])) {
    $element['#id'] = drupal_html_id('edit-' . implode('-', $element['#parents']));
  }

Thats's were the wrong IDs come from. I guess somewhere down the chain #attributes['id'] isn't propagated to #id.

For reference, attached is a patch on webform that works fine with webform_conditional.

Stalski’s picture

The explanation is correct.

I needed it in the select component , so I added :

'#id' => 'webform-component-' . str_replace("_", "-", $component['form_key']),

So even the str replace is needed for me. After that it works.
It can easily be reproduced on longer existing sites where webform module was installed in early stages. Somewhere along the way, in the same 7.x-3.x branch of webform, it got fixed.

steeph’s picture

Issue summary: View changes

#11 works for me. But not for fieldsets that are inside another fieldset.