【问题标题】:Select box doesn't collapse after an item selected and onchage ajax event fired选择项目后选择框不会折叠并触发 onchange ajax 事件
【发布时间】: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,
  );

【问题讨论】:

标签: ajax drupal-7 opera


【解决方案1】:

Opera 从 v10 for Windows 开始就有这个错误。我花了 3 个小时努力解决这个问题,但没有给出任何结果。我认为没有明智的方法来赢得它=(

【讨论】:

  • 谢谢。有什么“不合理”的解决方案吗?
  • 我见过一些解决方案,它应该在点击后插入延迟。虽然没有测试
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-08-07
  • 2018-08-02
  • 1970-01-01
  • 1970-01-01
  • 2021-06-27
相关资源
最近更新 更多