Webform changed how fieldset.inc's webform_fieldset_prerender()
function sets the fieldset's ID: It now uses drupal_html_id()
on the ID, causing Webform Conditional to no longer hide conditional fieldsets.
The introduced bug is in Webform Conditional's _webform_conditional_get_css_id()
function, which now incorrectly computes the value of the fieldset's ID attribute.
The fix is to emulate drupal_html_id()
's behavior when determining the $css_id
for fieldsets (and not any other component type; Webform currently only uses drupal_html_id()
for fieldset IDs). Webform Conditional cannot call drupal_html_id()
on the calculated $css_id
, because drupal_html_id()
has a counter and will increment the ID when Webform's functions call it again on the same candidate ID.
Comment | File | Size | Author |
---|---|---|---|
#1 | webform_conditional-fieldset_incompatible_css_ids-2238961-1.patch | 1.6 KB | jay.dansand |
Comments
Comment #1
jay.dansand CreditAttribution: jay.dansand commentedHere is a quick patch (tested lightly; "it works for me" right now) that tries to predict the
$css_id
by emulatingdrupal_html_id()
. It is brittle ifdrupal_html_id()
's implementation changes.Comment #2
green_eye55 CreditAttribution: green_eye55 commentedWorked for me too! Thanks.
Comment #3
buddaThis patch fixed my issue too.
Reason was what I suspected, glad somebody has already written the patch :-)
Can we get the patch committed to the dev branch ?
Comment #4
Daniel Wentsch CreditAttribution: Daniel Wentsch commentedYay, thanks for the patch, fixed the issue for me, too.
Comment #5
sgardapee CreditAttribution: sgardapee commentedWe tried the patch, it does not help. For those that say it worked, what version of webform_conditional and webform are you using. This issue began when we upgraded from 7.x-1.0-beta1 to 7.x-1.0-beta2. At the same time we upgraded webform version 7.x-3.18 to 7.x-3.20. Did it work for existing forms, or newly created forms after the upgrade.
Comment #6
Daniel Wentsch CreditAttribution: Daniel Wentsch commentedWebform 7.x-3.20
Webform Conditional 7.x-1.0-beta2
After Updating Webform to 7.x-3.20 the webform conditonals stopped working correctly (showing fieldsets when they should have been invisible).
Existing forms worked correctly again after patching.
Haven't created new ones since.
Comment #7
sgardapee CreditAttribution: sgardapee commentedThanks so much for the info. I determined that the patch was not getting applied correctly. I misspelled it in my makefile. Once it was corrected, the form worked great!
Comment #8
jay.dansand CreditAttribution: jay.dansand commentedUpdate: This patch is no longer necessary in Webform 7.x-3.21 and higher. As of 7.x-3.21,
drupal_html_id()
is no longer used inwebform_fieldset_prerender()
. For more information, see #2243483: Change in Fieldset id generation.Comment #9
gregoryshearer CreditAttribution: gregoryshearer commentedIt appears if you upgrade Webform after Webform Conditional is patched, the patch causes the same symptoms as it once fixed. I needed to reverse the patch to get my conditionals to work on fieldsets.
Comment #10
jay.dansand CreditAttribution: jay.dansand commentedCorrect: the patch fixed the Webform 7.x-3.20 issue by making Webform Conditional emulate
drupal_html_id()
when calculating fieldset IDs (so the calculated IDs matched Webform's IDs again). As of Webform 7.x-3.21,drupal_html_id()
is no longer used, so the calculated IDs no longer line up with the HTML that Webform is generating.