我正在使用标准的D7 Ajax API来加载/更改表单元素。选择一个项目后选择框不折叠并onchage ajax事件触发
所以我试图得到:
使3个相关的选择框。即当选择第一个值时,第二个和第三个变化。第三个选择框取决于第二个。
除了Opera for Win [所有浏览器都没有问题](我使用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,
);
请参阅我的回复http://stackoverflow.com/questions/7684991/select-in-opera-doesnt-close-on-change-event为好和坏消息.. – hallvors