Simplesearch stopped submitting

Ok this is another weird one. I’ve had simplesearch working for a while now, on a site that I’ve been devving for freaking ever. All recent changes to the site have been in templates and styles, nothing hard core. Been using the same CSS framework from the very beginning, shouldn’t be any changes there.

Problem: Type in search box, hit enter, nothing happens. It used to do the search upon hitting enter, looks like the jQuery in the default template detects that enter-key hit.

Try: OK so I type in the search box, hit the submit button and I get my error page.

Try: Directly in the browser url I type<query string> and I DO get my results.

How do I diagnose this? I know jQuery is running, my CSS framework (UI-Kit) depends on it. The development copy of the site is available if it helps you to verify

Any help is appreciated! :confused:

Hi @ritchiedalto, I can reproduce your issue and has most likely to do with the way how JS changes the page. In the source code of your site you have four search boxes. But on your site you only see two. The other two are hidden for some reasons I don’t understand. One of them is registered as the first form; meaning it gets fired first when you press a button. But since this form is hidden you can alter the value it has (you can do it only for the search forms, which are visible). That’s why hitting enter (or the button) redirects you to (always with an empty query).

I actually don’t know if this is an issue only for your site or a general one, since SimpleSearch is designed only for one search form per page(?).

As Sommerregen says, I count 4 search forms on your page code. Only one shows, the other 3 are hidden. Just searched for data-search-input

The JS is not working because of this, it’s not considering a case where more than one form is present.

The base Simplesearch code should work, I just tried it myself. Check if you are including the search twig more than once.

OMG thank you! Yes there should be only 3 search boxes, I’ll have to find that fourth! And it’s because I wanted it to appear in 3 different places, the main header, the header that appears after you scroll, and in the off-canvas menu. I think I’ll narrow that down to two and then straighten out the rest of the javascript. I suppose I can change the javascript so that it is unique to each box and pulls the entered text from only the one being used.

Again, thanks a bunch, I am out of my mind with a tight deadline!