2+ Tabs causing duplicate ids

hefox - October 29, 2009 - 02:53
Project:Tabs (jQuery UI tabs)
Version:6.x-1.2
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

If tabset_name isn't given, it defaults to tabset.

tabset_name goes through form_clean_id

however, the id that is used is actually tabs-tabset_name, which form_clean_id isn't told so doesn't keep track

Then later in the code the tabs_names are set to tabs-tabset_name-1.

So image two tabs with tabset_names not set till arriving at the function. they're given the name tabset. Form cleans this to tabset-1 on the second. However tabs-tabset-1 is what the actual id.. which is what also the first tab in the first tabset is also id.

The simpliest solution is to add 'tabs-' . () inside the form_clean_id when determining tabname, but it causes uglier ids later. But if that's okay, I'll mke a patch.

#1

nedjo - October 29, 2009 - 21:33

Thanks for the report, please go ahead and generate a patch. That'll help see the precise source of the issue.

#2

hefox - October 29, 2009 - 22:35

Here ya go,
Removes "tabs- from the theme function and moves it into the initial form_clean_id

The second patch isn't tested yet (made it while writting about how the above patch creats tabs-tabs-tabset class later on and figured it'd be relevant to try and not have that happen).

AttachmentSize
tabs_dup_id.patch 1.46 KB
tabs_dup_id_1.patch 1.93 KB

#3

hefox - November 4, 2009 - 21:53

Meh, fail @ my last patch.

Here's the corrected patch.

AttachmentSize
tabs_dup_id_1.patch 1.99 KB

#4

mrblaq - December 5, 2009 - 02:28

Looks like all the fixes are in tabs_dup_id_1.patch eh? This worked as expected for me! I had posted about this problem here: http://drupal.org/node/650658 Thanks for the fix!

#5

savedario - December 6, 2009 - 13:49

Yes, Thank for the fix... very timely.

I had to apply it manually as my patch (openSuse 11.1) says for tabs_dup_id_1.patch :
patching file tabs.module
patch: **** malformed patch at line 27: @@ -81,7 +81,7 @@
(I do have Tabs 6.x-1,2 installed)

 
 

Drupal is a registered trademark of Dries Buytaert.