1

Using Drupal 7.16 and Panels 7.x-3.3: I have created a View and exposed it's form in a Block. Then I have created two Panel Pages:

  • /search which displays the Exposed Form Block
  • /results which displays the View's Content Pane

Now whenever I submit the Exposed Form Block, it redirects to the root page (/). I am aware of the "Inherit Path" setting, but that changes nothing to me. As far as I understand, this setting isn't what I'm looking for, anyway.

How do I get the Exposed Form Block to submit its query to the page where the corresponding View Content Pane is placed? Is modifying the code the only way to achieve this?

  • this question is a duplicate, it's been answered here – pinueve Aug 1 '17 at 1:15
0

In my theme's template.php I did the following which seemed to work

/**
 * Implements hook_form_alter()
 */
function cmfzen_form_alter(&$form, &$form_state, $form_id) {

  // change the main search form
  // see http://drupal.stackexchange.com/questions/28404/easiest-way-to-add-x-webkit-speech-to-the-search-blocks-input-element
  // see http://adaptivethemes.com/html5-placeholder-text-for-your-drupal-7-search-field
  if ($form_id == "views_exposed_form" && $form['#id'] == "views-exposed-form-site-search-page"){
    // dsm($form);
    // redirect to a panels page with an embedded search_api view with facets.
    $form['#action']='hello';
    $form['site-search']['#type'] = 'searchfield';
    $form['site-search']['#attributes'] = array(
      'class' => array('search-site'),
      'placeholder' => t("I'm looking for..."),
      'speech x-webkit-speech spellcheck' => 'false',
      );
    // change form submit button
    //$form['submit']['#type'] = 'button';
    //$form['submit']['#value'] = '<span class="icon-untitled-8"></span>';
    $form['submit']['#attributes'] = array('class' => array('search-button'));
  }
}

Notice the part $form['#action']='hello'; ? Make sure your using the right formid and also change "hello" to whatever page you want the results to go to

Maybe that will lead you in the right direction?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.