Ordering in cascading dropdown

bobede

Member
I have a membership form where the visitor first selects the type of membership, which then populates a cascading dropdown that gives renewal options with the costs.

The options are typlically:
One year $30
Two years $55
Three years $70

The problem though is that the cascading dropdown renders the options in alphabetical order, so it shows:
One year $30
Three years $70
Two years $55

When I created the list for the membership options I entered the records in the proper order. Does anyone know if there is a way to change the order that the options in the cascading dropdown are displayed?
 
You should be able to use the WHERE filter on the CDD, under the Advanced tab ...

Code:
1=1 ORDER BY {thistable}.id ASC

The 1=1 is just to fake out the WHERE part.

-- hugh
 
You should be able to use the WHERE filter on the CDD, under the Advanced tab ...

Code:
1=1 ORDER BY {thistable}.id ASC

The 1=1 is just to fake out the WHERE part.

-- hugh

Thanks Hugh.

Unfortunately, that resulted in an Error 1064 - doesn't seem to like the SQL syntax.
 
Boy, is my face red! I assumed that you inserted "thistable" just as a reference and I replaced it with the actual table name. Your code works perfectly.

Thanks!
 
Ah, I usually remember to say something about using {thistable} literally without changing it.

The reason for that is we have to provide a way of referencing the joined table in query customization, but we don't know ahead of time what the actual table alias will be. We have to use aliases, like "SELECT foo AS foo_0 ..., foo AS foo_1", because you may have multiple joins to the same table. If we didn't use the foo_X alias, MySQL would blow up on "SELECT foo ..., foo ...".

So we provide the {thistable} placeholder, which we replace with the alias being used for that specific join at runtime.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top