Displaying many-to-many relationships in forms

Soldato
Joined
18 Oct 2002
Posts
9,044
Location
London
I was trying to google for some info, but I'm not really sure what I'm looking for.



Many-to-many-Relationship.png



So the product can appear in many categories. The obvious answer is to use checkboxes. They could then tick as many options as they like.
But what if you have 20+ options, checkboxes don't seem to cut it, and I'm scratching my head trying to think of another way of displaying the data.

Any ideas? Or sites I should look into? :)
 
Checkboxes, or two list boxes one with the selected items, the other with the options and buttons to transfer from one to the other.

Both solutions suck, but thats all I could think of too. :D
 
I was thinking of that one, but I don't really like the idea of all that javascript... mainly because I hate writing it! Although I have a feeling it might be the only option :(
 
Checkboxes are fine, IMO. I have looooads of categories on my site, but it's ok finding them in the list so long as they're sorted.
 
Checkboxes would at least be quicker to do, overall.

How do you go about displaying them?
I've got my data and form elements in a table, so I guess it's acceptable to put a nested table in there?
Hopefully get 2 or 3 items rows per row then.
 
I usually put them in a <ul>, hide the bullets, and make them run left-to-right using float and display:block and a fixed width for each label. It depends on how you want to arrange them though I guess, and whether that suits the data (long labels would be more awkward to arrange this way).

Also, don't forget to use <labels>! Selecting a lot of checkboxes when you can only click the box itself and not the text describing it is extremely frustrating in my opinion. :)
 
Thanks I'll give the <ul> a go :)

I agree, re: labels. It's a surprising amount of effort to click in that little box. Especially on high res screens.
Makes me laugh when I see people doing it, even when I tell them "you can click the label". But they still fumble around aiming for the box. :cool:
 
Back
Top Bottom