Hi,
i have a dynamic dropdown (users) the value key is id and the text key is name.
This results in a drop down list that is sorted on id and not on name, is there any way i can add some sort of "order by" or do i have to set the value key to name?
Hi redowl,
Please try the Order Fields box on the Data Displayer tab of the DB Multi Record Loader action. I think that may work OK.
Bob
Hi GreyHead
I got the same issue with a dynamic drop-down from a database table. When I try your solution a table with a sortable clumn is shown above the drop-down (I don't want that), and the drop-down is still not sorted (it's sorted by cf_id).
Hi rogeranton,
Which solution did you try? The one in the FAQ should be OK?
Bob
Hi
I've tried the FAQ solution. I just don't get it to work.
The dynamic drop-down works fine , but I'm not able to change the default sorting.
The On Load event holds only three actions:
Show HTML
Custom Code
DB Multi Record Loader
I've copied the first code from the FAQ to the Custom Code action and changed the highlighted 'id' to 'firmanavn'. Is that really the only thing I have to do?
Roger
Hi Roger,
I think that the Custom Code needs to be after the DB Multi-Record Loader, otherwise there is no data to sort. And I'd probably put the Show HTML action last to be tidy.
Bob
The changes didn't make any difference. Would you care to take a look at my form? The site is not in production so it's ok if you mess it up :wink:
The drop-down appears to be alphabetically because it is entered alphabetically in the table, but the last entry starts with A and shows up at the bottom. The form name is SSV_arsmote.
I'll send you login info in a PM if it's ok.
Roger
Hi roger,
By all means email or PM me the site URL, the name of the form, and a SuperAdmin login and I'll take a quick look.
Bob
Thank's a lot Bob. This works just as I want it.
Roger
Hi Roger,
Thanks :-)
For other readers: This creates a MySQL WHERE clause like WHERE 1 ORDER BY `column_name` and because '1' is always true in MySQL that part does nothing leaving just the ORDER BY clause. The '1' is needed because otherwise the clause would be WHERE ORDER BY . . . which is not valid.
Bob