Title: Search function bugs
Last modified: June 22, 2021

---

# Search function bugs

 *  Resolved [cambofrizz](https://wordpress.org/support/users/cambofrizz/)
 * (@cambofrizz)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/search-function-bugs/)
 * First of all: interesting plug-in and very useful for many people, I think. It
   should have much more attention (and downloads).
 * Anyway, I’m testing the search function and have a few comments, which may be
   some improvements. I’ve made some modifications to the wibergsweb.js file, but
   let me make clear that I’m not an expert in javascript.
 * The thing is that if you click on ‘Reset’ the full table displays, although I’ve
   set hidetable_load to “yes”. Therefor, I’ve added one line after line 35, so 
   they now look like this:
 *     ```
       tablewrapper_obj[0].outerHTML = response.tabledata;
       $('tr').hide();
       ```
   
 * If you now click on ‘Reset’ the table disappears. Maybe it’s even enough to just
   comment that line with ‘tablewrapper_obj’, possibly with an ‘if’ statement that
   checks whether you want a clean page on pageload?
 * Another thing is that a click on ‘Search’ with nothing filled in the searchbox
   also displays the full table. Not ideal. To check whether there’s a value in 
   the search box (and what the length is), I’ve included an ‘if’ statement after
   line 65. It looks like this:
 *     ```
               var search_text = $(this).parent().find('.search-text').val(); 
       		if (search_text.length < 5) {  
       			alert('Please enter a minimumn of 5 characters');
       			return false;
       		}
               var h = $(this).data();
       ```
   
 * This checks if the search string is at least 5 characters, otherwise it will 
   display an alert and abort the function. Can be any length of course. I suppose
   it could be further adjusted by checking for numbers only or letters only.
 * And lastly, there’s a thing I couldn’t find a solution for. If you search for
   anything that you are sure is not in the table, the ‘result’ is again the full
   table display. That’s of course not how search should be working. There should
   be a “Sorry, didn’t find anything” message. But apart from that I’m wondering
   why there even is a ‘result’, it should return nothing. Has this to do with what
   seems to be a ‘wildcard’ function in search?
 * Again, a very good plug-in and I hope you keep up the good work!

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [wibergsweb](https://wordpress.org/support/users/wibergsweb/)
 * (@wibergsweb)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/search-function-bugs/#post-14599105)
 * Hi!
 * Thank you for much for appreciating my plugin! And thank you very very much for
   your input!
 * I want to applogize for being a few days late in response. It’s been some holidays
   here in Sweden and I don’t see these message until I actuall browser around on
   my plugin page (I don’t get any messages of any sort to my mailbox or similar)
 * hidetable_load attributes does what it expects to do: “Hide table at **pageload**
   if set to yes”. I added this attribute because of a request for it. But I totally
   understand your point and I think the way to go here is to add another attribute
   for hiding table at reset (It might not always you want that).
 * “Another thing is that a click on ‘Search’ with nothing filled in the searchbox
   also displays the full table. Not ideal. To check whether there’s a value in 
   the search box (and what the length is), I’ve included an ‘if’ statement after
   line 65. ”
    I will absolutely add a feature for this. I will get back to you 
   when it’s done!
 * “And lastly, there’s a thing I couldn’t find a solution for. If you search for
   anything that you are sure is not in the table, the ‘result’ is again the full
   table display. That’s of course not how search should be working. There should
   be a “Sorry, didn’t find anything” message.”
    Of course! You are so correct. 
   Thank you for pointing this out! Next version of the plugin should be some better
   handling of search-functionality.
 * “But apart from that I’m wondering why there even is a ‘result’, it should return
   nothing. Has this to do with what seems to be a ‘wildcard’ function in search?”
   I’m not absolutely sure what you mean here but I get overall picture about your
   feedback which I value very high!
 * I will add new message here when I’ve added some of these features you were missing.
 *  Plugin Author [wibergsweb](https://wordpress.org/support/users/wibergsweb/)
 * (@wibergsweb)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/search-function-bugs/#post-14600957)
 * So now I’ve added some features (in version 1.1.96 of my plugin) which I hope
   will be a better solution!
 * **Version 1.1.96 – new attributes:**
    * attribute hide_reset=”yes” to hide table
   when clicking on the “reset”-button * notfound_message=”Search did not give any
   results” (for example) – when searchresult not found * search_requiredchars=”
   5″ – tells how many characters user must enter in searchfield * search_requiredchars_message
   =”You have to enter at least 5 chars” – message when required fields are not 
   given
 * * searchinput_placeholder=”enter your searchtext here” – Text to show as description
   in searchinput field
    * search_realtime=”yes” – Make search when user has stopped
   typing (about a second afterwards)
 *  Plugin Author [wibergsweb](https://wordpress.org/support/users/wibergsweb/)
 * (@wibergsweb)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/search-function-bugs/#post-14602254)
 * You can view some examples/demos at [https://wibergsweb.se/plugins/csvtohtml/](https://wibergsweb.se/plugins/csvtohtml/)

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Search function bugs’ is closed to new replies.

 * ![](https://ps.w.org/csv-to-html/assets/icon-128x128.png?rev=1397040)
 * [CSV to HTML](https://wordpress.org/plugins/csv-to-html/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/csv-to-html/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/csv-to-html/)
 * [Active Topics](https://wordpress.org/support/plugin/csv-to-html/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/csv-to-html/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/csv-to-html/reviews/)

## Tags

 * [csv](https://wordpress.org/support/topic-tag/csv/)
 * [tables](https://wordpress.org/support/topic-tag/tables/)

 * 3 replies
 * 2 participants
 * Last reply from: [wibergsweb](https://wordpress.org/support/users/wibergsweb/)
 * Last activity: [4 years, 11 months ago](https://wordpress.org/support/topic/search-function-bugs/#post-14602254)
 * Status: resolved