logo

Response

« Return to the main article

You are viewing this page out of context. To see it in the context it is intended please click here.

About This Page

Reply posted by Jeb Cashin on Wed 15 Oct 2003 in response to Control the look of the "No documents found" message

A Dynamic Find and Replace

After reviewing all posts here, I found yet another method which is preferrable
for my application. I use category view queries like this...
productview.dsp?OpenForm&Products=ABRAS:Con
... that can return "No Documents Found." The view has documents, just not with
the category, so I cannot depend on a row count in the view.


This method effectively does a find and replace on the text "No Documents
Found" on the fly.


Thanks to Fernando Matias Valadao who posted this on
http://searchdomino.techtarget.com.


1) In the "HTML Head Content" of your form or page, add this code: "<style> H2
{display:none;} </style>"


This momentarily hides any H2 text, including the No Documents Found message.


2) Add this code to the "On Load" event of your form or page. It searches all
H2 text and replaces the No Document Found text. It then displays all H2 text.


var noDocumentsFound = document.body.all.tags("H2");
var tagH2, textH2;


for (var i = 0; i < noDocumentsFound.length; i++){
tagH2 = noDocumentsFound[i];
textH2 = tagH2.innerText;
if (textH2.toLowerCase() == "no documents found"){
tagH2.innerHTML = '<BR><FONT SIZE=2 FACE="Arial" Color =#00673>Nothing found.
Please search again.</FONT>';
}
tagH2.style.display = "block";
}