I just posted the code for a dual select box ColdFusion custom tag called cf_SelectSwap.
It takes a query of items and produces two DHTML list boxes. Users can pick items from the available list and move them to the selected list. The selections are stored to two form variables. The first is a list of selected values, the other a list of selected display text values.
If a user has JavaScript disabled, it degrades down to a single list box with items selected. It can be used multiple times within the same cfm template.
Nothing earth shattering, but I put it together in the middle of a project I am working on. Maybe someone else can get some mileage out of it.
nice one! thanks for sharing
Exactly the tag I needed, thanks for making it available. Adding a “double-click to add” feature would just about wrap up the feature set.
It took a few minutes staring at the example code before the workings became clear, so here’s a cheat sheet for others:
The query you feed the tag must contain columns named VALUE and DISPLAY. Microsoft Access reserves VALUE so brackets are required as in this actual query:
SELECT SongID AS [Value], songtitle & ‘ ‘ & ‘(‘ & authorname & ‘)’ AS Display, lyrics FROM Songs
Lawrence — thanks for the feedback. I will take a look at adding the double click to add feature.
There’s a way around the VALUE / DISPLAY field naming. You can override the names of these fields. The tag accepts ValueField and DisplayField attributes. You can define the query column name of both or either field.