So right now I have a browse user page that lists all of the logged in users on my site. If you are looking for a particular person you can enter their name and location in a single search box (views2 exposed search box filter) at the top of the page.

What I want to do now is:

If someone searches but does not find the person listed on my site-

1. the page either automatically runs a query on a Google custom search that I already have set up for the same info.

and/or

2. displays the Google custom search box and removes the original views2 search field. (I'm think a redirect to a new Google Custom Search page on a no result)

I know these are possible to do but I just need a point in the right direction. I would love to be able to do #1 above but will settle for hel with #2 in the mean time.

Any help would be very appreciated.

Cheers,

Latte/

Comments

nevets’s picture

Consider using the "Empty Text" to embed the logic and produce the display.

latte’s picture

yeah right now I have the GCS search form in the Empty Text. I might drop some javascript in there to change the the visibility of the views form to hidden or display none. I just have to figure out how to do that.

I'm more of a UI designer than a developer, but I have gotten this far (Cup half full).

Cheers,

Latte/

latte’s picture

I was able to hide the Views search form with the following Javascript.

<script>
var browserType;

if (document.layers) {browserType = "nn4"}
if (document.all) {browserType = "ie"}
if (window.navigator.userAgent.toLowerCase().match("gecko")) {
 browserType= "gecko"
}

function hidesearch() {
  if (browserType == "gecko" )
     document.poppedLayer = 
         eval('document.getElementById("views-exposed-form-user-search-page-1")');
  else if (browserType == "ie")
     document.poppedLayer = 
        eval('document.getElementById("views-exposed-form-user-search-page-1")');
  else
     document.poppedLayer =   
        eval('document.layers["views-exposed-form-user-search-page-1"]');
  document.poppedLayer.style.display = "none";
}



window.onload = hidesearch;

</script>

I added that to the Empty Text area in Views2 and it did the trick.

nevets’s picture

How about a jQuery approach

 $(document).ready(
   function() {
      $('#views-exposed-form-user-search-page-1').hide();
   }
);
latte’s picture

I just tried you code and it didn't seem to work.
I put it in the no text field and set it to HTML (also tried PHP) and nothing happened.

I ran a search that returned no data and the views form was still there.

Latte,