No Documents Found

After reviewing all posts here, I found this method preferrable for my application, because I needed to provide a different message other than No Documents Found. Thanks to Fernando Matias Valadao who posted this on http://searchdomino.techtarget.com.

I’ve made one technical correction. Step 2 needs to be in the On Load and not the JS Header.

1) In the “HTML Head Content” of your form or page, add this code: “&lt style&gt H2 {display:none;} &lt/style&gt”

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 = '
Nothing found. Please search again.‘;

}

tagH2.style.display = “block”;

}

Leave a Reply

Your email address will not be published. Required fields are marked *