This topic is locked

Multiselect ordering question

5/26/2008 10:24:55 PM
PHPRunner General questions
T
thebwit author

Ok took a bit of searching but I figured out how to do a multiselect instead of a single drop down select. My question is, is there a way to then set the order of the items selected?
Like say I have the following in the multi select:

Apples

Oranges

Bananas

Pears

Plums

Peaches

Star Fruit
And then I have a table of Fruit Vendors and each vendor can select a min of 1 to a max of all the fruit that they sell. But the thing is, they don't want to display it alphabetically or by the default fruit_id.
IE vendor A has selected Apples, Pears and Plumbs and wants them displayed in that order

Vendor B has also selected Apples, Pears, and Plumbs but wants them displayed as Plumbs, Apples, Pears
Any, all help will be greatly appreciated.

J
Jane 5/27/2008

Hi,
unfortunately it's impossible to edit order of selected values.

You can only change order of all values in this dropdown (on the "Edit as" settings dialog on the Visual Editor tab).

A
alang 5/27/2008

You can add a code hook into "commonfunctions.php" to add functionality to the way dropdowns work. See my earlier post: http://www.asprunner.com/forums/index.php?showtopic=6477.
The suggestion would be to add a table (many-to-many link table between vendors and item) with foreign key to vendor and item with a field called "displayorder" that allowed each vendor to manually set the display order of items offered. This could be included in the SQL to generate the items in the drop down list and allow you to add "ORDER BY `displayorder`.