Делаю иерархию терминов таксономии с помощью ahah helpera город>район>улица
но есть проблема если после выбора улицы поменять город обновляется поле район, но поле улица не обновляется
Как можно его удалять или автоматически заставить изменяться после обновления предыдущих полей.
<?php function ahah_helper_demo_form($form_state) {
$form = array();
// Register the form with ahah_helper so we can use it. Also updates
// $form_state['storage'] to ensure it contains the latest values that have
// been entered, even when the form item has temporarily been removed from
// the form. So if a form item *once* had a value, you *always* can retrieve
// it.
ahah_helper_register($form, $form_state);
// Determine the default value of the 'usage' select. When nothing is stored
// in $form_state['storage'] yet, it's the form hasn't been submitted yet,
// thus it's the first time the form is being displayed. Then, we set the
// default to 'company'.
$form['billing_info'] = array(
'#type' => 'fieldset',
'#title' => t('Billing information'),
'#prefix' => '<div id="billing-info-wrapper">', // This is our wrapper div.
'#suffix' => '</div>',
'#tree' => TRUE, // Don't forget to set #tree!
);
$form['billing_info']['usage'] = array(
'#type' => 'select',
'#title' => t('Usage'),
'#options' => get_term_children(5),
'#default_value' => $form_state['storage']['billing_info']['usage'],
'#ahah' => array(
'event' => 'change',
// This is the "magical path". Note that the parameter is an array of
// the parents of the form item of the wrapper div!
'path' => ahah_helper_path(array('billing_info')),
'wrapper' => 'billing-info-wrapper',
),
);
$form['billing_info']['update_usage'] = array(
'#type' => 'submit',
'#value' => t('Update usage'),
// Note that we can simply use the generic submit callback provided by the
// ahah_helper module here!
// All it does, is set $form_state['rebuild'] = TRUE.
'#submit' => array('ahah_helper_generic_submit'),
// We set the 'no-js' class, which means this submit button will be hidden
// automatically by Drupal if JS is enabled.
'#attributes' => array('class' => 'no-js'),
);
drupal_set_message('<PRE>'.print_r($form_state, 1).'</PRE>');
// If 'company' is selected, then these two form items will be displayed.
if(isset($form_state['storage']['billing_info']['usage'])){
$form['billing_info']['usage2'] = array(
'#type' => 'select',
'#title' => t('Usage'),
'#options' => get_term_children(5, $form_state['storage']['billing_info']['usage']),
'#default_value' => $form_state['storage']['billing_info']['usage2'],
'#ahah' => array(
'event' => 'change',
// This is the "magical path". Note that the parameter is an array of
// the parents of the form item of the wrapper div!
'path' => ahah_helper_path(array('billing_info')),
'wrapper' => 'billing-info-wrapper',
),
);
}
if(isset(
$form_state['storage']['billing_info']['usage2'])){
$form['billing_info']['usage3'] = array(
'#type' => 'select',
'#title' => t('Usage'),
'#options' => get_term_children(5, $form_state['storage']['billing_info']['usage2']),
'#default_value' => $form_state['storage']['billing_info']['usage3'],
'#ahah' => array(
'event' => 'change',
// This is the "magical path". Note that the parameter is an array of
// the parents of the form item of the wrapper div!
'path' => ahah_helper_path(array('billing_info')),
'wrapper' => 'billing-info-wrapper',
),
);
} else {
unset($form['billing_info']['usage3']);
}
$form['save'] = array(
'#type' => 'submit',
'#value' => t('Save'),
);
return
$form;
} ?>
3 сутки бьюсь и не могу понять как каим образом и что нужно передавать в форму, чтобы заставить ее перестроиться