0

我有三个相关的下拉框,选择第三个选项后,会生成一个表格,表格的每一行都有删除链接,正在用表格内容替换所有下拉列表但是新的下拉列表失去了 ajax 功能再生代码如下

$form['ajax_fieldset'] = array(
                                    '#type' => 'fieldset',
                                    '#prefix' => '<div id="ajax_data_wrapper">',
                                    '#suffix' => '</div>',
);


$form['ajax_fieldset'] = array(
                                            '#type' => 'fieldset',
// These provide the wrapper referred to in #ajax['wrapper'] above.
                                            '#prefix' => '<div id="ajax_data_wrapper" style="">',
                                            '#suffix' => '</div>',
);


$form['ajax_fieldset']['country_select'] = array(
                      '#type' => 'select',
                      '#title' => t('Country List'),
                      '#options' => $countries_list,
                        '#ajax' => array(
                                    'wrapper' => 'ajax_data_wrapper',
                                    'callback' => 'get_country_select_callback',

),
);



$form['ajax_fieldset']['lang_select'] = array(
                      '#type' => 'select',
                      '#title' => t('Language List'),
                      '#options' => array(),
);



$form['ajax_fieldset']['audio_select'] = array(
                              '#type' => 'select',
                              '#title' => t('Audio List'),
                              '#options' => array(),
);


$table_data_1=table_creater($urls[2]);

$form['ajax_fieldset']['library_table']=$table_data_1;
$commands = array();
$commands[] = ajax_command_replace("#ajax_data_wrapper",    render($form['ajax_fieldset']));
4

1 回答 1

0

必须使用ajax_deliver()如下方法,

 $commands = array();
$commands[] = ajax_command_replace("#selected_audio_wrapper", render($form['selected_audio_fieldset']));
$commands[] = ajax_command_invoke(NULL, "call_from_ajax", array("") );
$page = array('#type' => 'ajax', '#commands' => $commands);
ajax_deliver($page);
于 2013-12-11T13:35:53.797 回答