Revision 1b

Tested with Mozilla 1.7.12, Firefox 1.5, Opera 9, Konq, and IE 6. Not yet tried with Safari. Will work fine in old browsers. Need to test marginals (those with annoyingly sporadic DOM support that claim they work but don't)

A demo with it working in the Trac Ticket page

How to use it:

  1. Download componentselect.js
  2. Include the file in the Trac newticket page, via a <script type="text/javascript" src="componentselect.js"></script>
  3. Add #properties select.haikucomponent { width: 10em; float: left; clear: left; } to the css file

Changes

Version 1a
Initial release.
Version 1b
Fixed <select>s that don’t contain an initial “null” selection, so we add the first sub component <select> now too.
Version 1c
D’oh. Fixed change 1b for cases when <select> doesn’t have a choice selected. We now tell the browser to pick the first item.
Version 1d
I found a problem while playing with Trac [ my, isn't testing good fun? :) ] In the case that a component has already been selected, we add all the dropdowns for that range of subchoices, so drivers/graphics/nvidia adds three <select>s. However, with playing around with browsers, onchange doesn't fire if you click an item that is already selected. So we need to add '' as an option to default to to allow users to select the top most choice and have an update. (Forgot to mention, it also fixes the flaw with '' entries and adds sorting so we dont get duplicate entries) Feedback via email