Select triple a discesa anche con element non solo con form

1 contenuto / 0 new
Select triple a discesa anche con element non solo con form

Ciao a tutti, ho realizzato delle select a discesa triple che funzionano benissimo quando utilizzo il form di drupal:

<?php
//questa è una parte per indicare cosa intendo per form cioè $form
  
$form['country'] = array(
     
'#type' => 'select',
     
'#ahah' => array(...........
     
'#title' => t("Nazione"),............segue);
   
$form['country_regions'] = array(
     
'#type' => 'select',
     
'#ahah' => array(...........
     
'#title' => t("Regions country"),............segue);
   
$form['country_cities'] = array(
     
'#type' => 'select',
     
'#title' => t("Country cities"),............segue);
    return
$form;
 
?>

ora il metodo ahah e funzione con $country_id = $_POST['country']; posso cambiare il valore preso da db, vedi: http://danzisiweb.it/informationphp/what/nazioni-method-ahah INVECE con gli elementi no, non riesco ad utilizzzare nè il metodo $_POST nè il $form_state, o meglio a passare alla funzione ahah
<?php
function cck_nations_related_select_process($element, $edit, &$form_state, $form) {
 
$field_name = $element['#field_name'];
 
$field = $form['#field_info'][$field_name];
 
$field_key = $element['#columns'][0];
  if (
is_array($element['#value']) && !array_key_exists($field_key, $element['#value'])) {
   
$element['#value'] = optionwidgets_data2form($element, $element['#default_value'], $field);
  }
 
$element[$field_key] = array(
   
'#type' => 'select',
   
'#title' => $element['#title'],
   
'#description' => $element['#description'],
   
'#required' => isset($element['#required']) ? $element['#required'] : $field['required'],
   
'#multiple' => isset($element['#multiple']) ? $element['#multiple'] : $field['multiple'],
   
'#options' => cck_nations_related_country_values(),
   
'#default_value' => isset($element['#value'][$field_key]) ? $element['#value'][$field_key] : NULL,
  );
  
$element['countryid'] = array(
   
'#type' => 'select',
   
'#title' => t("Country"),
   
'#required' => TRUE,
   
'#multiple' => FALSE,
   
'#options' => cck_nations_related_country_values(),
   
'#ahah' => array(
       
'path' => 'cck_nations_related/resrenderelements-country',
       
'wrapper' => 'ahah-wrapper-countryid',
       
'effect' => 'fade',
       
'event' => 'change',
        ),
  );
 
//........altri elementi
 
$form_state['#field_info']['cck_nations_related'] = $element;
  return
$element;
}
//
function cck_nations_related_resrenderelements_country() {
 
$form_state = array('submitted' => FALSE);
 
$form_build_id = $_POST['form_build_id'];
 
$form = form_get_cache($form_build_id, $form_state);
  if (!
$form_build_id) {
   
drupal_set_message(t('An unrecoverable form_build_id: %form_build_id', array('%form_build_id' => print_r($form_build_id))), 'error');
    print
drupal_to_js(array('data' => theme('status_messages')));
    exit;
  }
 
//questo post funziona
 
$countryid = $_POST['countryid'];
 
$result_regions = db_query("SELECT ........ WHERE $countryid")
 
//questa select non funziona più e non so perchè
 
$form['regionid'] = array(
         
'#type' => 'select',
         
'#title' => t("Regions"),
         
'#required' => FALSE,
         
'#options' => $opt_country_regions,
         
'#prefix' => '<div id="ahah-wrapper-countryid">',
         
'#suffix' => '</div>',
         
'#ahah' => array(
            
'path' => 'cck_nations_related/resrenderelements-regions',
            
'wrapper' => 'ahah-wrapper-cityid',
            
'event' => 'change',
            
'effect' => 'fade',
            
'method' => 'append',
           ),
      );
//............
 
$output = drupal_render($form[regionid]);
 
drupal_json(array('status' => TRUE, 'data' => $output));
  exit;
}
?>

Il fatto che devo utilizzare gli elementi di drupal è perchè sto realizzando un modulo cck con hook_process
Difficile ma qualche esperto lo sa sicuramente!! La domanda è come utilizzare un $element con #ahah ?
Grazie in anticipo