Basically, if I search from the homepage the form looks like this

 <form action="/"  accept-charset="UTF-8" method="post" id="search-block-form">

If I search form an inner page for example node 2, it would look like this

 <form action="node/2"  accept-charset="UTF-8" method="post" id="search-block-form">

It still sends me to the right page which I have set to be /search/rru
So then if I search again from that page, it works, because it's on the right search URL

 <form action="search/rru"  accept-charset="UTF-8" method="post" id="search-block-form">

I am confused why the form action piece is grabbing the current URI instead of keeping it consistant at what I set on the settings page which should be search/rru

Comments

sczizzo’s picture

I've also had trouble with the behavior of the action attribute: When logged in, using the search block form works as expected; I type in some keywords, hit submit, and I am redirected to the search results page. When logged out, however, I type in some keywords, hit submit, and I see the URL change to a seemingly random (but valid) path, and then I am successfully redirected. I was pretty confounded by this, but looking at the HTML it makes sense: I just wasn't noticing the change in the URL before, because the URLs matched. I also happen to agree with the submitter that the form should submit to a single location instead of the current page.

sczizzo’s picture

Here's about what I did to fix this myself, so that the redirect appears seamless:


function mymodule_form_alter(&$form, &$form_state, $form_id) {
  switch ($form_id) {
    // By removing the form's action it's POSTed to the current page, and we avoid some weird URL flashing across the address bar
    case 'google_appliance_search_form':
      $form['#action'] = NULL;
      break;
  }
}

VanD’s picture

I was able to make the change trying FALSE, NULL and 'search/rru'
With no success.

I believe my problem no resides that the form is sending two requests.
The first one with the search term, which returns the proper result. And a second one, which is sending a blank request, and returning no result.

The results page is picking up that second request, the blank search.