【发布时间】:2011-10-13 20:01:14
【问题描述】:
我正在使用标准 D7 Ajax API 来加载/更改表单元素。
所以我想得到什么:
制作 3 个相关的选择框。 IE。 when a value from the first one is selected, the second and third change.第三个选择框依赖于第二个。
除了 Opera for Win [Linux 没有问题](我使用的是 v11.51)之外,所有浏览器都可以正常工作。 当您从选择框中选择一个项目(在 Opera 中)时,尽管触发了 ajax 事件并成功加载了数据,但它不会折叠。
如果触发事件,有什么方法可以在事件发生后折叠选择框?
这是表单的 php 代码:
$form['type'] = array(
'#type' => 'select',
'#options' => _bp_filter_get_types(),
'#attributes' => array('onReady' => "alert('Hello!');return false;"),
'#prefix' => '<p>',
'#suffix' => '</p>',
'#ajax' => array(
'callback' => 'bp_filters_header_group_js',
'wrapper' => 'bp-filters-header-group',
'method' => 'replace',
'effect' => 'none',
'progress' => array('type' => 'none'),
),
);
$form['brand'] = array(
'#type' => 'select',
'#options' => $brand_options,
'#prefix' => '<span id="bp-filters-header-group"><p id="bp-filters-header-brand">',
'#suffix' => '</p>',
'#disabled' => $brand_disabled,
'#ajax' => array(
'callback' => 'bp_filters_header_group2_js',
'wrapper' => 'bp-filters-header-group2',
'method' => 'replace',
'effect' => 'none',
'progress' => array('type' => 'none'),
),
);
$form['series'] = array(
'#type' => 'select',
'#options' => _bp_filter_get_series($type_tid, $brand_tid),
'#prefix' => '<span id="bp-filters-header-group2"><p id="bp-filters-header-series">',
'#suffix' => '</p>',
'#disabled' => $series_disabled,
'#ajax' => array(
'callback' => 'bp_filters_header_submit_js',
'wrapper' => 'bp-filters-header-submit',
'method' => 'replace',
'effect' => 'none',
'progress' => array('type' => 'none'),
),
);
$form['submit'] = array(
'#type' => 'submit',
'#attributes' => array('class' => $submit_classes),
'#value' => '',
'#prefix' => '<p id="bp-filters-header-submit">',
'#suffix' => '</p></span></span>',
'#disabled' => $submit_disabled,
);
【问题讨论】:
-
查看我在stackoverflow.com/questions/7684991/… 上的回复,了解好消息和坏消息..