﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
7009	Fix for hide/collapse of fieldsets in admin when fieldsets are added dynamically	punteney	nobody	"Currently in CollapsedFieldsets.js when it's initialized it gets gets an array of the fieldsets on the pages and then for the ones that are expand/contract it passes the the index number of that array to the onclick function to determine what fieldset should be displayed or hidden. Then in the show and hide function it queries the document again for all the fieldsets and selects the appropriate one based on the fieldset_index that was passed on to it. This breaks if a fieldset is dynamically added or removed from the page after the initialization as the array of fieldsets is now a different length (in my case it's an option to toggle the YUI rich text editor on or off that causes the problem to occur). 

The attached patch changes it so an id is created for the fieldset if it doesn't have one and then the id is passed along with the fieldset_index to the show and hide functions. The correct fieldset is then found through the document.getElementById so as to be always be the correct one even if fieldsets are added or removed.
"	Bug	closed	contrib.admin	dev	Normal	fixed	javascript collapsing fieldsets	punteney@… email@…	Design decision needed	1	0	0	0	0	1
