mixing a radio button or drop down box into a list of checkmarks dynamically?
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233
Rep:
mixing a radio button or drop down box into a list of checkmarks dynamically?
here is my problem
I am creating a php based, e-commerce type site where a user can order a custom product based on a list of available options, however some of them are an either this or that, so a simple list of check boxes wouldn't be quite adequate
for instance as an entertainment system might be
CD player
turntable
cassette deck
VCR
DVD player
blue-ray player
8 track player
40 watt receiver, 50 watt receiver OR 100 watt receiver
10" woofers, 12" woofers, or 15" woofers
25" plasma TV, 25" LCD TV, 52" LCD TV etc...
of course the cd player through the 8 track player can be checkboxes since you either add that item or you don't but obviously it would be preferable to have either radio buttons for the speakers, tvs, and receivers since you arent gonna order more then one tv, receiver or set of speakers
how can I, reading from a single array, tell my script whether a given item in the list belongs as a check box or part of the appropriate radio button group or drop down list?
You've got two related - but logically separate - design issues:
a) Design of the "presentation" (what is the HTML the user will see)?
b) Design of the "back end" (what is the program logic needed to create the HTML? What data and data attributes is that program logic going to need)?
STRONG SUGGESTIONS:
1. Mock up a couple of prototypes of the "presentation".
First in pencil-and-paper, then some quick'n'dirty HTML
2. Draft your schema.
If CD's need checkboxes, but speakers need radio buttons, maybe (for example) you need a "singleOption/multipleChoice" flag in your data record.
3. Don't worry about the PHP coding until *after* you're clear about the "data" and "presentation" layers.
'Hope that helps .. PSM
PS:
If ordering an MP3 player is easy ("I want this model or that model"), but ordering a home entertainment system is complex (every module has lots of inter-related options), maybe you want to create some kind of "wizard" for your presentation (walk the user through a set of web pages to help him selecting the right components).
Just a thought...
PPS:
???8 track player??? Did you say "8-track player"?!? Just curious... ;-)
PPS:
What about '78's? Or 45's? Some original Artie Shaw (or Spike Jones ;-)), on acetate?
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233
Original Poster
Rep:
Quote:
Originally Posted by paulsm4
Hi -
You've got two related - but logically separate - design issues:
a) Design of the "presentation" (what is the HTML the user will see)?
b) Design of the "back end" (what is the program logic needed to create the HTML? What data and data attributes is that program logic going to need)?
STRONG SUGGESTIONS:
1. Mock up a couple of prototypes of the "presentation".
First in pencil-and-paper, then some quick'n'dirty HTML
2. Draft your schema.
If CD's need checkboxes, but speakers need radio buttons, maybe (for example) you need a "singleOption/multipleChoice" flag in your data record.
3. Don't worry about the PHP coding until *after* you're clear about the "data" and "presentation" layers.
'Hope that helps .. PSM
PS:
If ordering an MP3 player is easy ("I want this model or that model"), but ordering a home entertainment system is complex (every module has lots of inter-related options), maybe you want to create some kind of "wizard" for your presentation (walk the user through a set of web pages to help him selecting the right components).
Just a thought...
PPS:
???8 track player??? Did you say "8-track player"?!? Just curious... ;-)
PPS:
What about '78's? Or 45's? Some original Artie Shaw (or Spike Jones ;-)), on acetate?
i did say 8 track player
actually my site isn't selling entertainment centers that was just a generic example
thx though
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.