By loze on
Is it possible to put the results of a view into optgroups for a cck nodereference select field?
I am able to get the data from views. However even if i set 'group fields', it populates the select field with a flat list, even though my views preview properly groups them.
Is optgroups with nodereference possible or am i just doing it wrong?
thanks
Comments
Anyone do this before?
Anyone do this before?
Subscribing
Subscribing...
subscribe
subscribe
It seems this still hasn't
It seems this still hasn't been solved. I opened a feature request in the CCK issue queue: #1045326: Make grouped records show up as optgroups.
I have the same issue, and I'm writing a little hack for it
I discussed the issue today, and I couldn't find a solution by using CCK alone, so I coded my own method by using hook_form_alter.
Drupal allows to create items in Select Widgets by passing an array of arrays:
I therefore added a hook_form_alter function where I process the Option List contained in the Select Field I'm interested into, and I re-format it by adding the Groups. It's a bit of a hack (first attempt), but it works reasonably well.
For more information, see http://www.drupalcenter.de/node/21463 (in German, but the code is quite clear).