Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
It depends of course. Are the values static or dynamic? Localized? How many?
A dropdown is just a UI control to select one value from a list. When you realize that, you also realize that it depends on the contents of that list. -
dootlurk6313yI've seen a few different database centric versions, and am firmly on the side of storing all lookup values in a single table, but also storing the string directly in the database record instead of the reference. It makes all the difference when lookups get updated by idiots and you don't then lose data integrity.
Hard coding seems wrong for anything which has the potential to change, but is perfectly good for core options essential to functionality -
k-ko273yBecause of
- mostly language dependent and
- mostly many values using an autocomplete UI
> database
Also the frontend devs can mostly not know, what the backend will do with the values ... -
Crost41082yI like to think of the backend in terms of an API. If I use an API I don't expect to first call the API to get a list of viable options to choose from, I read their docs. So for me I hard code the options in the frontend but if it's multi choice it's usually an enum for me
front end devs, do you put your dropdown values in a database or in the code? follow up question. if database, do you put all the dropdowns in one table?
question