You are viewing limited content. For full access, please sign in.

Question

Question

Weblink change no results found Wording

asked on January 24, 2019

I am currently creating a Weblink page and have a requirement that when no results found appears (like below) that the wording needs to be changed to say "No Results found. Please contact us for more information"

Can anyone point me to the right place where i can customize this?

0 0

Replies

replied on January 24, 2019 Show version history

You can modify DocView.aspx Search.aspx by adding the following just above the closing body tag.

    <!-- custom script -->
    <script type="text/javascript">
        $(document).ready(function() {
            $("span[lflocalize='STR_NO_RESULTS_FOUND']").text("No Results found. Please contact us for more information");
        });
    </script>
    <!-- end custom script -->
</body> <!-- don't add these last two tags, I just included them to show you where to put the script tag above.
</html>

 

0 0
replied on January 28, 2019

Hi Devin,

 

Thanks for your reply.

Is the DocView.aspx file located under Web files?

 

The following is an example of the URL I am working with that returns 'No Results Found':

https://HostName/Weblink/search.aspx?searchcommand=%7B%5B%5D%3A%5B%5D%3D"181"%7D&dbid=0

 

When I used you code it had no effect.

Can you tell where I am going wrong?

 

0 0
replied on January 28, 2019

You're right. I used the wrong file name. It should be Search.aspx.

0 0
replied on February 14, 2019 Show version history

 

I added the script to the search.aspx file and it is still not working. I attended empower last week and in one of the weblink classes they mentioned something about having to put custom javascript inside a loop for it to appear but i haven't been able to find anything further on this, the slides from the class would be great (Developer 302: Advanced Weblink Configuration) but I don't think they have been made available yet.

 

 

0 0
replied on February 14, 2019 Show version history

It works fine in our test environment. Can you move the script block so that it is just above the </body> tag? That last div may have some functionality attached to it that's interfering.

I wouldn't put anything in a loop. There might be a specific circumstance where that can help, but not here. Like I said, I tested a couple of methods, and this is the one that is the simplest.

0 0
replied on March 19, 2019
<script type="text/javascript">
	$(document).ready(function() {
		waitForEl("span[lflocalize='STR_NO_RESULTS_FOUND']",changeText);
	});
	
	function changeText(){
                 $("span[lflocalize='STR_NO_RESULTS_FOUND']").text("No Results found. Please contact us for more information."););
	}

	//https://gist.github.com/chrisjhoughton/7890303
	function waitForEl(selector, callback, maxtries = false, interval = 100) {
		const poller = setInterval(() => {
		const el = jQuery(selector)
		const retry = maxtries === false || maxtries-- > 0
		if (retry && el.length < 1) return // will try again
		clearInterval(poller)
		callback(el || null)
		}, interval)
	}
</script>

Dean,

 This may be the type of loop they were talking about. Try this above the </body> tag and see if it works for you.

0 0
replied on April 2, 2019 Show version history

Hi everyone,

My version is 10.1.0.60 and neither of these suggestions work for me either. I did reset WWW service after each change, too.

What does Laserfiche think?

-Ben

replied on April 2, 2019

I've not had any luck using these suggestions to alter search.aspx, but modifying welcome.aspx was much easier:

 

    <script type="text/javascript">
      $(document).ready(function() {
        //use startsWith because at present there's a trailing space that might not be there in the future.
        if ($('#SearchResultContainer').html().startsWith('No results found')) {
          $('#SearchResultContainer').html('You don\'t have access to this document.');
        } else {
        }
      });
    </script>
</body>
</html>

 

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.