I have this select drop down menu that I would like to have either show
default values for the menu or have it grab from the database the values
already selected (as the user can change their selections anytime they
want). I imagine that I would have to be using an id somewhere, but Im
just not sure on where to even start. Here is my code for the select:
I have this select drop down menu that I would like to have either show
default values for the menu or have it grab from the database the values
already selected (as the user can change their selections anytime they
want). I imagine that I would have to be using an id somewhere, but Im
just not sure on where to even start. Here is my code for the select:
Pretty straight forward. airlineinfo is the name of the table in the
database and smoking is the name. Thanks,
~S
what are the values in the db? is this a boolean field ( smoking → true
/ false ) or a text field? if it is a simple yes / no smoking option
(boolean) you could use a checkbox rather than a select … if you need
a select box, the way to go is using the below;
I guess the idea that I’m trying to convey is that a user can go and
fill out their preferences for seating, smoking, etc., in a form. Later,
if they so choose too, they can edit or change the values that they have
made in that form, switch their window seat preferences to aisle, for
example. What I would like to happen is for their original preferences
to be visable every time they go back to modify the form (or any changes
that are made). This way, to me, it just re-assures the user that the
values they entered in the original filling out of the form took and
were saved. The way the form is set-up now, however, is to show the
default values in the select boxes whenever the user goes back to visit
that form.
This sounds like an html question! I haven’t tried this, frankly, but
seeing how most of the options that goes under helper class methods
seem to be html options themselves, you might try this: