dongtuo3795 2015-12-04 15:56
浏览 39

如何删除视图外露过滤器中的应用按钮

In my drupal 7 site I want to remove an apply button in form I created in Views (Exposed form in block = Yes). I tried this in my template.php:

function myproject_preprocess_views_exposed_form(&$vars, $hook) {
    dpm($vars);
    if ($vars['form']['#id'] == 'views-exposed-form-search-page') {
        // Remove the submit button ??
        unset($vars['form']['submit']);

    }
}

... but that does not work. Can any one point me in the right direction? //Tommy EDITED: I now succeeded in removing the button, with this snippet:

function myproject_form_views_exposed_form_alter(&$form, &$form_state, $form_id) {
if ($form['#id'] == 'views-exposed-form-search-page') {
    // submit on enter

    // Remove the submit button ??
    unset($form['submit']);

    }
}

... so what I need now is how to submit the form on enter. I keep trying.

  • 写回答

2条回答 默认 最新

  • dqq46733 2015-12-04 20:04
    关注

    I complicated this too much. Just hiding the button with CSS with:

    .views-submit-button{ display:none; }

    ... and everything worked as it was supposed to.

    评论

报告相同问题?