Hi I'm doing a selection with 4 levels of hierarchy, as I can use this module to accomplish this. I install the module and Libraries, and also the module selects Chained and libraries but I can not see the widget.

How to inform Drupal that successful this library?

Thanks

Comments

amitaibu’s picture

Status: Active » Fixed

> but I can not see the widget.

There's no widget, you need to use custom code.

cmfeliz’s picture

Thanks

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

arifeboy’s picture

Status: Closed (fixed) » Active

Hi

I still confuse to apply the sample that you give (http://drupal.org/project/chained_selects) to my custom module.

I had activate the library module and the chain select module, but when i try to apply your code to my custom module...and then it's not working.

Please give me the full sample in custom module complete with form that contain the chained select.

Thankyou for your help.

ethnovode’s picture

Hey, got it working with this code :

$options = array(
    '' => '--',
    'bmw' => t('BMW'),
    'audi' => t('Audi'),
  );

  $form['mark'] = array(
    '#type' => 'select',
    '#title' => t('Select 1'),
    '#options' => $options,
   //CUSTOM :
    '#attributes' => array('id' => 'edit-mark'),
    '#default_value' => 'audi',
  );

  $options = array(
    '' => '--',
    'series-3' => t('3 series'),
    'series-5' => t('5 series'),
    'series-6' => t('6 series'),

    'a3' => t('A3'),
    'a4' => t('A4'),
    'a5' => t('A5'),
  );

  $options_attributes = array(
    'series-3' => array('class' => 'bmw'),
    'series-5' => array('class' => 'bmw'),
    'series-6' => array('class' => 'bmw'),

    'a3' => array('class' => 'audi'),
    'a4' => array('class' => 'audi'),
    'a5' => array('class' => 'audi'),
  );

  $form['series'] = array(
    '#type' => 'select',
    '#title' => t('Select 2'),
    '#options' => $options,
    '#options_attributes' => $options_attributes,
    //CUSTOM :
    '#chained_selects' => array(
      'parent' => 'edit-mark',
      'child' => 'edit-series',
      ),
  );
  return $form;
nclavaud’s picture

Status: Active » Fixed

Opening another issue for this documentation problem.

See #1540782: Sample code on project homepage is bugged

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

eeakpabio’s picture

Status: Closed (fixed) » Active

Hi, I just happened to encounter this same issue of not being able to see any widget. As advices in previous comments above, am not expected to see any widget, but rather, am to use a custom code. I please need the following help;
1. What program do I use in typing this custom-code and what file-name do I give it?
2. What directory/folder do i place this file of custom code?
3. How do I integrate this chained-select-option (custome-code) as one of the components of a form that I have already created?
Many thanks for an anticipated help!

nclavaud’s picture

The example code above would work in a custom module, and more specifically in a hook_form() (or hook_form_alter) method.

The module does not provide widgets for entities fields, if this is what you mean by "a form that I have already created". In this case it won't help.