1

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." Reference : http://drupal.org/node/325766 -> "Entering options through the interface"

Is this something I can do with the defualt node select fields aka (list module) ie. http://drupal.org/documentation/modules/list ? 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, Hospital, Dental and Physicians 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.

2

You can do that if you use php to generate the allowed values, as you have already read in Select fields with group names?. However, that feature did not go into Drupal core when most of the CCK module for Drupal 6 was included in Drupal 7. The D7 version of CCK tries to provide this feature. As the module page says, it contains:

some miscellaneous helpers to do things that core will not do, like maintain the PHP code snippets some fields may have been using to define allowed values (partially working)

  • Thanks for the reply, but in my case I'm not generating the allowed values with php, I'm using it as a norm way, any other way of achieving that thing or please have a look at this also drupal.org/node/325766 in this -> "Entering options through the interface" is there any way in drupal to insert values like how we can do in webform? Cause that can also help me! – Rishi Kulshreshtha Nov 22 '11 at 6:30
  • As far as I know, the only way to do it in a field, is the way I describe above: install CCK and define your options as a PHP array. It doesn't need to be dynamic PHP that gets its values from somewhere else, it can be just the hard coded array. However you do need the PHP array because it supports nesting of options inside groups. – marcvangend Nov 22 '11 at 8:33
  • OK, means I've to install a new module CCK in my Drupal 7 and then I can do the above steps? Thanks in advance! – Rishi Kulshreshtha Nov 23 '11 at 9:32
  • In theory, yes. However the module page says "partially working" so I'm not 100% sure if the nested/optgroup part is working, but you can at least give it a try. – marcvangend Nov 23 '11 at 10:03
  • First of all thanks for helping me, I've installed CCK, but not getting where should I do the remaining steps like 'define your options as a PHP array' and I also wanna mention that you said 'It doesn't need to be dynamic PHP that gets its values from somewhere else, it can be just the hard coded array' what if I doesn't want it to be 'hard coded array' I need it should be added as simply as adding a value to the select text field in Drupal 7? – Rishi Kulshreshtha Nov 24 '11 at 6:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.