Project

General

Profile

Revision 51cc509a

ID51cc509a276ccf97f7a2135edac78fd6aa77b934
Parent 6c5e37d9
Child 92e38dee

Added by Patrick Plitzner over 5 years ago

#5890 pass classification root node uuid as argument to autosuggest
function

View differences:

modules/cdm_dataportal/cdm_csv_export/cdm_csv_export.module
73 73
  return $block;
74 74
}
75 75

  
76
function taxon_selection_update($form, &$form_state) {
77
  unset($form_state['input']['taxon_select'], $form_state['values']['taxon_select']);
78
  $tree = $form_state['input']['taxonNode'];
79
  $form['taxon_select']['#autocomplete_path'] = 'cdm_dataportal/taxon/autosuggest/'.$tree.'///';
80
  $form['taxon_select']['#value'] = '';
81
  return form_builder($form['#id'], $form['taxon_select'], $form_state);
82
}
83

  
76 84
/**
77 85
 * Creates the drupal form and returns it
78 86
 *
......
81 89
 *
82 90
 */
83 91
function cdm_csv_export_my_form($form_state) {
92
    $tree = variable_get(CDM_TAXONOMICTREE_UUID, FALSE);
84 93
    $form['combobox'] = array(
85 94
        '#type' => 'select',
86 95
        '#title' => t('Classification').':',
87
        '#default_value' => variable_get(CDM_TAXONOMICTREE_UUID, FALSE),
96
        '#default_value' => $tree,
88 97
        '#options' => cdm_get_taxontrees_as_options(FALSE, TRUE),
89 98
        '#attributes' => array(
90 99
            'name' => 'taxonNode',
91
            'onchange' => 'return validateForm()'),
100
            'onchange' => 'return validateForm()'
101
        ),
102
        '#ajax' => array(
103
          'callback' => 'taxon_selection_update',
104
          'wrapper' => 'taxon-selection',
105
          'progress' => array(
106
            'message' => '',
107
            'type' => 'throbber',
108
          ),
109
        )
92 110
    );
93 111
    $form['taxon_select'] = array(
94 112
        '#title' => t('Taxon'),
95 113
        '#type' => 'textfield',
114
        '#prefix' => '<div id="taxon-selection">',
115
        '#suffix' => '</div>'
96 116
    );
97 117
    if(variable_get('cdm_dataportal_taxon_auto_suggest')){
98
        $form['taxon_select']['#autocomplete_path'] = 'cdm_dataportal/taxon/autosuggest';
118
        $form['taxon_select']['#autocomplete_path'] = 'cdm_dataportal/taxon/autosuggest////';
99 119
    }
100 120

  
101 121
    $form['redListField'] = array(

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)