When you make a select list on a webform module you get the option to group values by a group name or category:
"Option groups for lists and menus may be specified with . <> can be used to insert items at the root of the menu after specifying a group."
Is this something I can do with CCK select fields? I have never heard of it but it would be nice.
I have to make a list of working group positions on my site and I have 3 groups each with it's own group name, Standing Task group, Sub Teams and management and I am trying to figure out the best way to list these groups and their positions in a nice select value widget.....
I was thinking of using taxonomy but it's not really the same thing as what I want.
Becky
Comments
Comment #1
markus_petrux CreditAttribution: markus_petrux commentedSupport for optgroups was recently added to CCK. However, you need to provide the list of allowed values using PHP code.
Example:
Of course, this structure can come from a Content Taxonomy widget, for example.
Comment #2
beckyjohnson CreditAttribution: beckyjohnson commentedOh awesome. Thanks. I don't know why I couldn't find the documentation for it earlier.
Thanks!
Becky
Comment #3
beckyjohnson CreditAttribution: beckyjohnson commentedI did some research and it looks like this only works with 6.x-2 dev. Is that correct? I put the php code in my cck widget in the php section and it did not work. I am using 6.x2.5.
Becky
Comment #4
markus_petrux CreditAttribution: markus_petrux commentedYou should put this PHP code in the proper textarea of the Allowed Values list section of the field settings. This is for Text or Number fields with select widget.
IIRC correctly, support for optgroups is present in CCK 6.x-2.5 already. See release notes or CHANGELOG.txt.
Comment #5
beckyjohnson CreditAttribution: beckyjohnson commentedHmmmmm Ok. I put my code in the php text area of the allowed values list section and when i went to create content, none of the options were present..... I will take another look.
Thanks,
Becky
Comment #7
francesco81rs CreditAttribution: francesco81rs commentedSorry, I do not know if I'm posting correctly.
But I wanted to ask if it is possible translate single items.
For example:
This doesn't work for me.
Thanks for the help.
Francesco.
Comment #8
Rishi KulshreshthaI'm having the same problem as mentioned by beckyjohnson, but I'm using Drupal 7, is it possible in Drupal 7 to have group names in select list? If yes, they please mention how can we achieve it.
Thanks in advance!
Comment #9
Rishi KulshreshthaI've gone through this post also http://fourkitchens.com/blog/2010/11/09/option-groups-drupal-forms, though it meets the requirement but as a new developer to Drupal, I didn't got all the points clearly in terms of how to apply that or how can we achieve that?
Can someone just help us out in getting the solution for this one or the above one.
Thanks in advance!
Comment #10
marcvangend@RishiKulshreshtha the issue for Drupal 7 is #1012640: Support grouping in allowed values for select list. Also note that the 'critical' priority is reserved for bugs (not support requests and feature requests) that completely break an entire site.