I am trying to get a JS search box (VisualSearch.js) working with little knowledge of JS. I managed to assign value to a hidden cms:input and submit the form with JS form.submit.

download (4).png
download (4).png (5.18 KiB) Viewed 406 times

This is how Search looks like and its GET values (serialized, whatever that means and looks like an array)
img-2016-05-13-21-08-19.png
img-2016-05-13-21-08-19.png (7.21 KiB) Viewed 406 times


I am attaching completed working sample and a simplest couch template with it, where search is passing values with GET to couch cms:form, using the following addon in jsscript:
Code: Select all
/*START: ADDED FOR COUCH FORM */            
           var element = document.getElementById("total");
           element.value = searchCollection.serialize();
           element.form.submit();
/*END: ADDED*/            


I would like someone who can at least *read* JS check this out and share a feedback.
Help is needed to create 'Search' button and make GET/POST request more easy to parse, whithout complications. Ideally, all the prefetched data for autocomplete and suggestions could be placed out of search.php file, to make it manageable with a lot of data.. Please and Thanks!
visualseach.js.demo.zip
(213.34 KiB) Downloaded 63 times


Edit: Found a simplified and modern sample
img-2016-05-13-21-59-16.png
img-2016-05-13-21-59-16.png (10.83 KiB) Viewed 404 times

search.js-master.zip
(154.81 KiB) Downloaded 67 times